什么是的DbContext和ObjectContext的之间的区别 [英] What's the difference between DbContext and ObjectContext

查看:322
本文介绍了什么是的DbContext和ObjectContext的之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从MSDN:

重新presents的单位按工作及库模式的组合,使您能够查询数据库,并组合在一起,然后将写回店为单位的变化。的DbContext在概念上类似于ObjectContext的。

Represents a combination of the Unit-Of-Work and Repository patterns and enables you to query a database and group together changes that will then be written back to the store as a unit. DbContext is conceptually similar to ObjectContext.

我虽然的DbContext只处理连接到数据库和对数据库工作线程的数量。

I though DBContext only handle the connection to the DB and the number of threads working against the DB.

现在我明白它包含了跟踪machanisem?我认为这是在ObjectContext的。

Now I understand it contains the tracking machanisem? I thought this was in the ObjectContext.

那么,什么是(用简单的英语)它们之间的区别呢?

So what is (in plain english) the difference between them?

推荐答案

的DbContext是ObjectContext类,这是奠定差不多吧上的ObjectContext之上的轻量级版本(甚至还有一个办法,从刚刚得到的ObjectContext的的DbContext)。这也是很多更容易使用,国际海事组织,使CRUD操作一个sinch。

DbContext is a lightweight version of the ObjectContext class, which is laid almost right on top of ObjectContext (there is even a way to get to the ObjectContext from just the DbContext). It's also a lot easier to use, IMO, and makes CRUD operations a sinch.

有关更好的信息,谁更好看比<一个href=\"http://thedatafarm.com/data-access/accessing-objectcontext-features-from-ef-4-1-dbcontext/\">Julie有关差异的详细信息勒曼,如被带进EF 4.1。

For better information, who better to look to than Julie Lerman for more info on the differences, as was brought into EF 4.1.

这篇关于什么是的DbContext和ObjectContext的之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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