ObjectContext的VS的DbContext [英] ObjectContext vs DbContext

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

问题描述

我一直的DbContext类从那里我有通用存储库中,导致使用ObjectContext的一个这样的方式实现和工作单位。我跟着<一个href="http://elegant$c$c.com/2009/12/15/entity-framework-ef4-generic-repository-and-unit-of-work-prototype/"相对=nofollow>一般来说这种链接。

我读过很多有关的ObjectContext VS的DbContext 这在一定程度是有道理的职位。但我不知道我的目前的执行情况。只是想知道如果它的反模式还是我打安全吗?

解决方案

的DbContext 只是一个围绕的ObjectContext 包装

的DbContext 仅仅是一组API,更容易比由的ObjectContext

反正这里有一个非常简单的VS使用Repository模式和EF模板

I've DbContext class from there I have an implementation of Generic Repositories and unit of work in a such way that leads to use ObjectContext. I followed this link in general.

I've read lot of posts related to the ObjectContext vs DBContext which somewhat makes sense. But I've no idea about my current implementation. just wondering if its an anti-pattern or I'm playing safe?

解决方案

DbContext is just a wrapper around ObjectContext

DbContext is just a set of APIs that are easier to use than the APIs exposed by ObjectContext

Anyway here there is a very simple VS Template that uses Repository Pattern and EF

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

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