实体框架:使用POCO方法更改SOA中的跟踪 [英] Entitity Framework: Change tracking in SOA with POCO approach

查看:244
本文介绍了实体框架:使用POCO方法更改SOA中的跟踪的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我们的分层应用程序中,我们通过WCF调用访问数据库。我们正在根据请求创建和处理上下文。另外我们正在使用POCO方法。

我的问题是,在纯POCO模型(完全持久的无知POCO)中,可以跟踪变化,同时我们正在创建和处理每个请求的上下文(如上一个上下文处理该服务电话)?如果是,EF如何处理这种情况?就我可以看到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?

推荐答案

不幸的是,你不会找到在Entity Framework v1.0中简单的解决这个问题。
已经有很多讨论和很少的决议。它是EF v1.0的许多已知问题之一,有一种方式,您将最终不得不编写很多代码来处理这个问题。

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.

在.NET 4.0中,ADO.NET团队已经引入了自我跟踪实体来解决这个问题。

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

这篇关于实体框架:使用POCO方法更改SOA中的跟踪的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆