Because I'm brand spanking new, an example would be greatly
appreciated. Thanks.
On Nov 19, 8:23 am, "Tuna Toksöz" <[EMAIL PROTECTED]> wrote:
> In web environment it is generally a best practice to open the session at
> the beginning of the request and close it at the end.
>
>
>
> On Wed, Nov 19, 2008 at 3:17 PM, 8bit <[EMAIL PROTECTED]> wrote:
>
> > I'm just trying to get a grasp on the fundamentals here. I'm trying
> > to figure out the best way to configure the ISessionFactory/ISession
> > for my ASP.NET application. I'm just afraid that I might be leaving
> > some connection open or perhaps implementing this the wrong way.
>
> > So, in my data layer, I have a base class:
>
> > Protected _sessions As ISessionFactory
>
> > Public Sub New()
> > _sessions = ConfigureSessionFactory()
> > End Sub
>
> > Protected Function ConfigureSessionFactory() As
> > ISessionFactory
> > Return _
> > (New NHibernate.Cfg.Configuration()).Configure
> > ().BuildSessionFactory()
> > End Function
>
> > And here is a sample of how I'm using a method in the "Tag" data layer
> > class:
>
> > Public Function GetAllTags() As IList(Of String)
> > Dim tags As IList(Of String) = Nothing
> > Dim session As ISession = Nothing
>
> > Try
> > session = _sessions.OpenSession()
> > tags = session.CreateQuery("select t.Name from Tag t
> > group by t.Name order by t.Name") _
> > .List(Of String)()
> > Finally
> > session.Close()
> > End Try
>
> > Return tags
> > End Function
>
> > Does this look ok? Any suggestions in regards to ISessionFactory/
> > ISession? Thanks.
>
> --
> Tuna Toksöz
>
> Typos included to enhance the readers attention!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---