UnitOfWork 和 GenericRepository Pattern 在 EF 4.1 代码中是多余的吗? [英] Is UnitOfWork and GenericRepository Pattern redundant In EF 4.1 code first?

查看:30
本文介绍了UnitOfWork 和 GenericRepository Pattern 在 EF 4.1 代码中是多余的吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

想知道我是否需要使用 Genericrepository 模式和 UnitOfWork 来模拟存储库.我正在使用 MOQ.它现在是否多余,因为我注意到 EF 4.1 具有 IDBSet.

Wondering if I need to use the Genericrepository pattern and UnitOfWork to mock the repository.I am using MOQ.Is it now redundant since I have noticed that EF 4.1 has IDBSet.

我还没有想出如何编写通用 IDBSet 的东西.如果你有一个实现 IDBSet 的示例,你能告诉我吗?

I have not figured out how to write something generic that usic IDBSet .If you have an example where you implement IDBSet can you show it to me?

有什么建议吗?

推荐答案

这是已经在 SO 上讨论过的许多主题的重复,但我同意其中一些可能很难找到,因为它们嵌套在其他问题中

This is duplicate of many topics already discussed on SO but I agree that some of them can be hard to find because they are nested in other question

我希望这会给你一些答案.如果没有,请随时在此处或在新问题中询问更多信息.

I hope this will give you some answers. If not, don't hesitate to ask for more information either here or in a new question.

这篇关于UnitOfWork 和 GenericRepository Pattern 在 EF 4.1 代码中是多余的吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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