Skip to main content
Automapper has its own website. Codeplex project page is deprecated (they are on github now).
Source Link

WCF's data objects should ideally be light-weight data transfer objects only. I would only re-use WCF's data objects if:

  • My Models are always going to be simple POCO objects. No validation, no business logic, no property change notification, etc
  • I don't care that the entire class as visible and fully accessible to whoever used it (You can't have read-only properties in a WCF data model)
  • My View does not bind directly to the Model, and instead binds to ViewModel properties which expose Model properties. This is the "MVVM-purist" approach, however if it often more trouble to implement than it is worth, so binding your View to your Model is also acceptable

That being said, I have never actually used WCF data objects as my Models. Usually I create Model objects separately, and my client-side data access layer converts the WCF data objects into Models for my application to use.

I usually use something AutomapperAutomapper for this, which will automatically map data from one class to another, providing the names and types are the same.

WCF's data objects should ideally be light-weight data transfer objects only. I would only re-use WCF's data objects if:

  • My Models are always going to be simple POCO objects. No validation, no business logic, no property change notification, etc
  • I don't care that the entire class as visible and fully accessible to whoever used it (You can't have read-only properties in a WCF data model)
  • My View does not bind directly to the Model, and instead binds to ViewModel properties which expose Model properties. This is the "MVVM-purist" approach, however if it often more trouble to implement than it is worth, so binding your View to your Model is also acceptable

That being said, I have never actually used WCF data objects as my Models. Usually I create Model objects separately, and my client-side data access layer converts the WCF data objects into Models for my application to use.

I usually use something Automapper for this, which will automatically map data from one class to another, providing the names and types are the same.

WCF's data objects should ideally be light-weight data transfer objects only. I would only re-use WCF's data objects if:

  • My Models are always going to be simple POCO objects. No validation, no business logic, no property change notification, etc
  • I don't care that the entire class as visible and fully accessible to whoever used it (You can't have read-only properties in a WCF data model)
  • My View does not bind directly to the Model, and instead binds to ViewModel properties which expose Model properties. This is the "MVVM-purist" approach, however if it often more trouble to implement than it is worth, so binding your View to your Model is also acceptable

That being said, I have never actually used WCF data objects as my Models. Usually I create Model objects separately, and my client-side data access layer converts the WCF data objects into Models for my application to use.

I usually use something Automapper for this, which will automatically map data from one class to another, providing the names and types are the same.

Source Link
Rachel
  • 24k
  • 16
  • 93
  • 160

WCF's data objects should ideally be light-weight data transfer objects only. I would only re-use WCF's data objects if:

  • My Models are always going to be simple POCO objects. No validation, no business logic, no property change notification, etc
  • I don't care that the entire class as visible and fully accessible to whoever used it (You can't have read-only properties in a WCF data model)
  • My View does not bind directly to the Model, and instead binds to ViewModel properties which expose Model properties. This is the "MVVM-purist" approach, however if it often more trouble to implement than it is worth, so binding your View to your Model is also acceptable

That being said, I have never actually used WCF data objects as my Models. Usually I create Model objects separately, and my client-side data access layer converts the WCF data objects into Models for my application to use.

I usually use something Automapper for this, which will automatically map data from one class to another, providing the names and types are the same.