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.
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.
Yes, you need to keep the primary keys around. I put them in the client facing objects themselves. You can pass them back as part of the object when the client is retrieving the data so that they can in turn pass it back to you on an update.
If the PK name doesn't really fit your abstraction, just call it something else, your services just need to know the mapping.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.