I have an N-Tier application where POCOs are populated by Entity Framework on the server side and transferred to my client applications. The clients make changes to the POCOs or add new POCOs and then send them back to the server to be stored in the database.
If I am using pure POCOs, i.e., no proxies, not self-tracking entities, what are some of the common approaches people are taking to solve the Change Tracking issue? If your service receives a collection of POCOs, how does it know to do an Add, Update or Delete using Entity Framework?
Entity Framework doesn't have good built-in support for such disconnected scenarios. I am aware of three general options:
Use GraphDiff, an open source add-on library
Advantages
Disadvantages
Update object graphs manually on server side (Example)
Advantages
Disadvantages
Add properties for entity states to your objects and track changes manually on client side by setting the states accordingly (I don't have an example for this approach; I believe, Julie Lerman is using and recommending it)
Advantages
Disadvantages
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With