views:

608

answers:

2

In our layered application, we are accessing database via WCF calls. We are creating and disposing contexts per request. Also we are using POCO approach.
My question is, in pure POCO model (completely persistent ignorant POCOs) is it possible to track the changes, while we are creating and disposing context per request (as previous context is disposed in that service call)? If yes how EF handles this situation? As far as I can see 2 mechanisms (snapshot based change tracking and notification based change tracking with proxies) will not be able to handle this? If not, how should we handle context so that we are able to track the changes?

+1  A: 

Unfortunately you won't find a simple solution to this in Entity Framework v1.0. There has been much discussion and little resolution. It is one of the many known problems with EF v1.0 and one way or another you will end up having to write lot's of code to handle this.

In .NET 4.0 the ADO.NET team have introduced Self-Tracking Entities to tackle this very problem.

willbt
+2  A: 

I'd say:

Do not use self-tracking entities in a pure SOA environment: The self-tracking entities only work when your clients use the generated proxy classes.

When you're doing SOA by the book, you cannot expect your clients to be .Net, or even more, .Net 4.0; Which is the only scenario in which self-tracking entities will work. Your services will be useless to any other clients.

Just My 2 cents, Regards, Koen

KoenJ