I made a site using ASP.NET MVC, NHibernate, and MySQL. In my project, I have several classes of repositories, each of which has methods using the following codes:
using(ISession session = NHibernateHelper.OpenSession()) {
using(ITransaction transaction = session.BeginTransaction()) {
session.Save(cidade);
transaction.Commit();
}
}
I came from a classic ASP, so I assume that the connection to MySQL is actually closed. In fact, I assume that there is a connection similar to what was in the classic ASP.
Do I have to do something to explicitly close the connection / session or is it "autoclassified"?
Is there a way to do it if there are many open connections open on my server?
Many thanks.
source
share