Unit of work/repository managers for NHibernate?

前端 未结 3 973

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 u

相关标签:
3条回答
  • 2021-02-04 17:32

    There are a few components you can use for easy Unit of Work implementations:

    • NHibernate Burrow - part of the NHContrib project
    • Rhino Commons - Unit of Work implementation, documentation is in sample code, on the blog and on the web
    • Conversation per Business Transaction - from Fabio Maulo, a primary nhibernate developer, with some documentation on his site

    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.

    0 讨论(0)
  • 2021-02-04 17:34

    You might also be interested in Castle ActiveRecord, which implements the ActiveRecord pattern on top of NHibernate, loosely inspired on Rails' ActiveRecord.

    0 讨论(0)
  • 2021-02-04 17:50

    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:

    http://code.google.com/p/nhibernate-unitofwork-example/

    0 讨论(0)
提交回复
热议问题