[英]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.