如何查看一个EntitySet的和未提交的更改? [英] How do I view an entityset and uncommitted changes?

查看:197
本文介绍了如何查看一个EntitySet的和未提交的更改?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用EF4和调试时,我希望看到什么样的变化即将作出的数据库。例如,如果我添加了一堆新的实体,如联系人,我希望看到将要当.SaveChanges添加联系人列表()执行。同样,如果会发生缺失,这将是很好看什么都会被删除。

I'm using EF4 and when debugging, I want to see what changes are about to be made to the database. For example, if I add a bunch of new entities, like contacts, I want to see the list of contacts that will be added when .SaveChanges() executes. Likewise, if deletions will occur, it would be nice to see what will be deleted.

有一个可视化工具或类似工具在VS2010这样做吗?

Is there a visualizer or similar tool in VS2010 that does this?

谢谢!

推荐答案

这直接是不可见的。最好的地方是检查 ObjectStateManager 持有状态条目每个实体和独立相关。每个 ObjectStateEntry 重presenting实体实体属性填补。

That is not visible directly. The best place is check ObjectStateManager which holds state entries for each entity and independent association. Each ObjectStateEntry representing entity has Entity property filled.

编辑:

如果您要访问这些数据,code,前者说明是非常有用的。如果你只是想看看它在调试器中添加 context.ObjectStateManager 来监视窗口并导航到非公共成员。您将看到字段:

The former description is useful if you want to access these data in code. If you just want to see it in debugger add context.ObjectStateManager to the watch window and navigate to Non-Public members. You will see fields like:

  • _addedEntityStore
  • _deletedEntityStore
  • _modifiedEntityStore
  • _addedEntityStore
  • _deletedEntityStore
  • _modifiedEntityStore

这篇关于如何查看一个EntitySet的和未提交的更改?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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