NHibernate - Is ITransaction.Commit really necessary?
- by user365383
Hi
I've just start studying NHibernate 2 days ago, and i'm looking for a CRUD method that i've writed based on an tutorial.
My insert method is:
using (ISession session = Contexto.OpenSession())
using (ITransaction transaction = session.BeginTransaction())
{
session.Save(noticia);
transaction.Commit();
session.Close();
}
The complete code of "Contexto" is here: http://codepaste.net/mrnoo5
My question is: Do i really need to use ITransaction transaction = session.BeginTransaction() and transaction.Commit();?
I'm asking this because i've tested run the web app without those two lines, and i've sucefully inserted new records.
If possible, can someone explain me too the porpuse of Itransaction and the method Commit?
Thanks