ObjectContext与DbContext [英] ObjectContext vs DbContext

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

问题描述

我有DbContext类从那里我有一个通用存储库和工作单元的实现,导致使用ObjectContext。我遵循这个一般链接。



我读过很多与 ObjectContext vs DBContext 相关的帖子,这有点有意义。但我不知道我目前的实现。只是想知道它是反模式还是我玩安全?

解决方案

DbContext 只是围绕 ObjectContext



DbContext 只是一组比 ObjectContext



所暴露的API更易于使用的方法这里有一个非常简单的VS模板,它使用Repository Pattern和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与DbContext的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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