8

I'm looking for a decent codebase that demonstrates how to use nHibernate as the persistance layer in an asp.net mvc3 project.

The two key pieces of understanding that I am looking to develop are

  1. How to deal with ISession and ISessionFactory.
  2. How to implement the repository pattern without leaking any details of its nHibernate implemenation.

I'm aware of Sharp Architecture and reading through that now - Its interesting but I'm more keen on finding a straight-forward web app to pick apart than another framework to learn.

Thanks in advance.

1
  • Maybe this article can be of help: hackingon.net/post/… . I read it and thought it was a pretty straight forward way of implementing NHibernate, which also isolates NHibernate to your MVC logic and therefor would be part of the rescue flow (and not end up with ASP.NET error if a dispose would throw an exception) Commented Feb 6, 2011 at 11:20

2 Answers 2

3

I put together a project that offers an example of how to do this using nhibernate and asp.net mvc 2. The repository and nhibernate implementations will be almost the same. Probably the biggest change will be the ioc / dependency injection piece. Take a look. It should provide a solid starting point. Here is the URL.

http://gpsnerd.codeplex.com

Let me know if you have questions.

Bob

Sign up to request clarification or add additional context in comments.

3 Comments

Looks fantastic - I'm also in to micro's so your arduino work looks very interesting too.
@rcravens your app looks damn good (i checked online demo) but there seems to be no code available on codeplex :(
I just checked. You can download the whole solution here: gpsnerd.codeplex.com/SourceControl/list/changesets
1

Take a look at https://bitbucket.org/FunnelWeb/dev

FunnelWeb is a blog engine based on ASP.NET MVC and NHibernate. It is opensource and used by many bloggers/develoeprs

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.