views:

1974

answers:

3

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.

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.

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.

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.

+4  A: 

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

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.

Steven Lyons
Quote "Fabio Maulo, an nhibernate developer...", I would say, he is THE nhibernate developer :-) Good answer anyway.
Stefan Steinegger
From watching the commit log and mailing list, I certainly can't argue with that. I actually typed it with a "the" initially and due credit should be given.
Steven Lyons
+1  A: 

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/

James Jones
+1  A: 

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

Mauricio Scheffer