I have WCF service which expose STE from EF.
[OperationContract, FaultContract(typeof(WarningFault)), FaultContract(typeof(ErrorFault))]
MyEntity GetMyEntityByID(int id);
[OperationContract, FaultContract(typeof(WarningFault)), FaultContract(typeof(ErrorFault))]
MyEntity SaveMyEntity(MyEntity myEntity);
Scenario look like this:
- client get entity from WCF(GetMyEntityByID)
- client make some changes to this entity
- client call SaveMyEntity
- in the WCF service is this particular entity attached to context and saved to db. (and there is also some custom validation work before saving itself.)
Because of STE, this is working quite fine..
But I have noticed, that this is not exactly good pattern. (in EF 5.0 are STE mark as Not Recommended)
What approach should I used instead of this? If I understand correctly WCF Data Services are not for this kind of work because they only expose entities. And saving, validation, etc. is managed on client side.