简体   繁体   English

将UnitOfWork与存储库模式一起使用

[英]Using UnitOfWork with the Repository Pattern

Very new to FluentNHibernate, but I'm also excited about the area. 对FluentNHibernate来说是新手,但我对该领域也感到兴奋。 I've recently started work on a new DAL using the aforementioned and have been reading up on the Repository pattern. 我最近开始使用上述方法开发新的DAL,并且已经在阅读Repository模式。 I like the generic form this pattern takes and am looking to use this pattern in conjunction with the UnitOfWork pattern for session management. 我喜欢此模式采用的通用形式,并且希望将此模式与UnitOfWork模式结合使用以进行会话管理。

I'm curious, is this the right direction to head? 我很好奇,这是正确的前进方向吗? Should I be using UoW to create a pseudo-singleton NHibernate session? 我应该使用UoW创建伪单NHibernate会话吗? This question really dances around the topic of NHibernate session management. 这个问题确实围绕着NHibernate会话管理这个主题展开。 There is a UoW implementation available that I've taken a look at, although I'm also unclear if I should be working to implement this library, or abstract my own. 我已经看过一个UoW的实现 ,尽管我也不清楚是应该实现这个库还是抽象我的库。

EDIT: 编辑:

Just for re-clarification of the question: 只是为了重新阐明问题:

Is it common practice to use the UoW pattern with the Repository pattern in a FluentNHibernate environment? 在FluentNHibernate环境中将UoW模式与Repository模式一起使用是常见的做法吗?

是的,作为一个很好的例子,请查看FubuMVC-Contrib的这些实现

我看到很多“我可以用Fluent NHibernate进行X处理”的问题-只是为了说明Fluent NHibernate位于NHibernate之上,为您吐出那些可怕的XML映射...这不会影响您可以做什么,不能做什么用NHibernate做。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 将SQliteAsyncConnection与UnitOfWork和存储库模式一起使用 - Using SQliteAsyncConnection With UnitOfWork & Repository Pattern 关于在存储库模式中使用UnitOfWork的困惑 - Confusion over using of UnitOfWork in Repository Pattern 使用UnitOfWork和存储库模式与实体框架 - using UnitOfWork and Repository Pattern with Entity Framework UnitOfWork模式的通用存储库模式 - Generic Repository Pattern with UnitOfWork Pattern 实体框架的存储库+ UnitOfWork模式 - Repository + UnitOfWork pattern for entity framework UnitOfWork +存储库模式-添加定制存储库 - UnitOfWork + Repository pattern - Adding a custom repository 如何使用存储库模式、服务模式、UnitOfWork、ORM(EF、NHibernate 等)构建带有 ASP MVC 的项目? - How to structure projects with ASP MVC using Repository Pattern, Service Pattern, UnitOfWork, ORM (EF, NHibernate etc..)? 使用 Repository 和 UnitOfWork 模拟删除 - Mocking A Delete using Repository and UnitOfWork 是否可以将Linqpad与Repository和UnitOfWork模式一起使用? - Is it possible to use Linqpad with a Repository and UnitOfWork pattern? 在实体框架中正确实现UnitOfWork和存储库模式 - Correct implementation of UnitOfWork and Repository pattern in Entity Framework
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM