I'm a .NET developer by day, but have been working with Rails and Merb for the past year on my own side projects, so when it comes to MVC and ORMs, I'm more used to them and using ActiveRecord and DataMapper.
我白天是.NET开发人员,但过去一年我一直在使用Rails和Merb在我自己的项目上工作,所以当涉及到MVC和ORM时,我更习惯他们并使用ActiveRecord和DataMapper。
I'm getting started with ASP.NET MVC, and I like what I see in NHibernate and Fluent NHibernate, but looking for a little bit more around how to best handle the unit of work or repository type model.
我开始使用ASP.NET MVC了,我喜欢我在NHibernate和Fluent NHibernate中看到的内容,但我还想了解如何最好地处理工作单元或存储库类型模型。
I'd like something that is not huge on architecture. I've seen some projects like S#arp Architecture, but it looks kind of bloated.
我想要一些在建筑方面不是很重要的东西。我见过一些像S#arp Architecture这样的项目,但看起来有些臃肿。
All I am really after is a simple way to manage connections and handling data retrieval/storage. A simple guide or sample application would even suffice.
我真正追求的是一种管理连接和处理数据检索/存储的简单方法。简单的指南或示例应用程序就足够了。
3 个解决方案
#1
11
There are a few components you can use for easy Unit of Work implementations:
您可以使用一些组件来轻松实现工作单元:
- NHibernate Burrow - part of the NHContrib project
- NHibernate Burrow - NHContrib项目的一部分
- Rhino Commons - Unit of Work implementation, documentation is in sample code, on the blog and on the web
- Rhino Commons - 工作单元实施,文档在示例代码中,在博客和Web上
- Conversation per Business Transaction - from Fabio Maulo, a primary nhibernate developer, with some documentation on his site
- 每个业务交易的对话 - 来自Fabio Maulo,一个主要的nhibernate开发人员,在他的网站上有一些文档
As for sample projects, here is one for Burrow. I am using Burrow for a project right now and it's working fine for me. Although I don't use them, there are repository classes that use the unit of work session management, so it is really easy to get going with it. I also use Fluent NHibernate and it's straightforward to get everything working together.
至于样本项目,这里有一个Burrow。我现在正在使用Burrow进行一个项目,它对我来说很好。虽然我不使用它们,但是存在使用工作会话管理单元的存储库类,因此很容易使用它。我也使用Fluent NHibernate,它可以直接使所有内容协同工作。
#2
2
You might also be interested in Castle ActiveRecord, which implements the ActiveRecord pattern on top of NHibernate, loosely inspired on Rails' ActiveRecord.
您可能也对Castle ActiveRecord感兴趣,它在NHibernate之上实现ActiveRecord模式,在Rails的ActiveRecord上松散启发。
#3
1
All I am really after is a simple way to manage connections and handling data retrieval/storage.
我真正追求的是一种管理连接和处理数据检索/存储的简单方法。
Yes, NHibernate can be pretty verbose. I've investigated both the Unit of Work and Repository "patterns" (they're actually "facades" but that's another story) and wrote very simple implementations of them. They both greatly simplify NHibernate, but I'd suggest using the Unit of Work implementation since I feel it's generally more performant and easier to use than Repository. Download it and give it a try:
是的,NHibernate可能非常冗长。我已经调查了工作单元和存储库“模式”(它们实际上是“外观”,但这是另一个故事),并编写了非常简单的实现。它们都大大简化了NHibernate,但我建议使用Unit of Work实现,因为我觉得它通常比Repository更高效,更易于使用。下载并尝试一下:
http://code.google.com/p/nhibernate-unitofwork-example/
http://code.google.com/p/nhibernate-unitofwork-example/
#1
11
There are a few components you can use for easy Unit of Work implementations:
您可以使用一些组件来轻松实现工作单元:
- NHibernate Burrow - part of the NHContrib project
- NHibernate Burrow - NHContrib项目的一部分
- Rhino Commons - Unit of Work implementation, documentation is in sample code, on the blog and on the web
- Rhino Commons - 工作单元实施,文档在示例代码中,在博客和Web上
- Conversation per Business Transaction - from Fabio Maulo, a primary nhibernate developer, with some documentation on his site
- 每个业务交易的对话 - 来自Fabio Maulo,一个主要的nhibernate开发人员,在他的网站上有一些文档
As for sample projects, here is one for Burrow. I am using Burrow for a project right now and it's working fine for me. Although I don't use them, there are repository classes that use the unit of work session management, so it is really easy to get going with it. I also use Fluent NHibernate and it's straightforward to get everything working together.
至于样本项目,这里有一个Burrow。我现在正在使用Burrow进行一个项目,它对我来说很好。虽然我不使用它们,但是存在使用工作会话管理单元的存储库类,因此很容易使用它。我也使用Fluent NHibernate,它可以直接使所有内容协同工作。
#2
2
You might also be interested in Castle ActiveRecord, which implements the ActiveRecord pattern on top of NHibernate, loosely inspired on Rails' ActiveRecord.
您可能也对Castle ActiveRecord感兴趣,它在NHibernate之上实现ActiveRecord模式,在Rails的ActiveRecord上松散启发。
#3
1
All I am really after is a simple way to manage connections and handling data retrieval/storage.
我真正追求的是一种管理连接和处理数据检索/存储的简单方法。
Yes, NHibernate can be pretty verbose. I've investigated both the Unit of Work and Repository "patterns" (they're actually "facades" but that's another story) and wrote very simple implementations of them. They both greatly simplify NHibernate, but I'd suggest using the Unit of Work implementation since I feel it's generally more performant and easier to use than Repository. Download it and give it a try:
是的,NHibernate可能非常冗长。我已经调查了工作单元和存储库“模式”(它们实际上是“外观”,但这是另一个故事),并编写了非常简单的实现。它们都大大简化了NHibernate,但我建议使用Unit of Work实现,因为我觉得它通常比Repository更高效,更易于使用。下载并尝试一下:
http://code.google.com/p/nhibernate-unitofwork-example/
http://code.google.com/p/nhibernate-unitofwork-example/