As part of my endless NHibernate-induced DAL refactoring purgatory, I have started to use the store pattern to keep NHibernate on arms length
My UI layer here provides an example of a method to load from a repository.
public stored load (int id) will be stored; (ESession session = NHibernate session factor. Open session ()) using {storedWill = session.Load < StoredWill & gt; (Id); } Refunded; } I like the fact that my website does not know what a hint is.
Naturally, I started to start lazy initial exceptions because the above method is not stored, it only gives a proxy when you use proxy properties, you get an exception Because you are living longer within the scope of ISession.
publicly stored load (int ID) {archived; Will be stored; (ESession session = NHibernate session factor. Open session ()) using {storedWill = session.Load < StoredWill & gt; (Id); String iReallyCouldntCareLess = Will.TestatorListName stored; } Refunded; } But all this seems a bit embarrassing Does someone use a slightly more elegant pattern?
You love people.
David
Use dependency injection and through your constructors your repository Pass an ISO for classes. The only way to allow many repositories to participate in a single transaction is to be.
Your website should have some knowledge of a Christian, because the transactions where defined boundaries are defined. You can use the session-per-request pattern so that ISession can only be referred to in the HttpRequest module or Global.asax. Or you can embrace NHibernate and control transactions using a quarter or pages.
Comments
Post a Comment