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.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---