Umbraco .NET user controls - fluent NHibernate
Does anyone have any suggestions for plugging Fluent NHibernate (or really any ORM) into a .NET user control accessed by Umbraco? I'm having trouble figuring out where the starting point is for creating the NHibernate session.
For example, on an ASP.NET MVC project, I can use the Applicatoin_Start and Application_BeginRequest events in the Global.asax to create a repository and inject it into my controller. On this Umbraco project I'm working on, I'm just going to be calling a user control (ie: Search.ascx), and referencing that control directly inside of Umbraco. Sure, I'll have the dll for it as well. But is there a way to create an NHibernate session without having to开发者_运维技巧 completely set it up each time I make a request?
This blog post looked interesting, however it never continued on to a part 2.
Please let me know if there are any sample project/tutorials that can walk me through this.
This isn't an umbraco specific question as if you have a user control it is more an ASP.Net question.
I think the recommended appraoch to to have a session per request, see:
http://ryanlanciaux.com/ryanlanciaux/post/NHibernate-Session-Per-Request.aspx
I hope this helps.
精彩评论