I got Entity Framework DbContext to work locally, connecting directly to the SQL database.
Now I am trying to put the Entity Framework stuff behind a WCF Service. The WCF Service will exposes its own set of service layer objects (DataContracts) corresponding to the underlying Entities. The client never knows about the underlying data store and entities.
- Getting data is easy, just a LINQ to SQL and .ToList();
- Inserting new objects is not too bad, pass a DataContract from the client to the WCF service via its OperationContract then WCF will call DbContext.Add(), DbContext.SaveChanges();
But how do I do an update? Do I need to preserve the PK? If so, what is the usual way of doing it?
You help is appreaciated. Thanks.