Tutorial :Where to reference session.BeginTransaction?



Question:

What is the dll that must be used? Where can I have it?

I am using Nhibernate, can I use it with NHibernate?


Solution:1

BeginTransaction() is a method on the NHibernate session. It's part of the NHibernate.dll in the current version of NHibernate.


Solution:2

Source: http://www.fincher.org/tips/Languages/NHibernate.shtml

using (ISession session = OpenSession()) {    using (ITransaction transaction = session.BeginTransaction()) {      IQuery query = session.CreateQuery("FROM Pet WHERE PetName = 'Rosie'");      Pet pet = query.List<Pet>()[0];      session.Delete(pet);      transaction.Commit();    }  }      static ISessionFactory SessionFactory;  static ISession OpenSession() {    if (SessionFactory == null) //not threadsafe        { //SessionFactories are expensive, create only once      Configuration configuration = new Configuration();      configuration.AddAssembly(Assembly.GetCallingAssembly());      SessionFactory = configuration.BuildSessionFactory();    }    return SessionFactory.OpenSession();  }  

http://www.google.com/search?q=session.begintransaction+nhibernate


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »