Quelle est la DLL qui doit être utilisée? Où puis-je l'avoir? J'utilise Nhibernate, puis-je l'utiliser avec NHibernate?Où référencer session.BeginTransaction?
0
A
Répondre
0
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
1
BeginTransaction() est une méthode sur la session NHibernate. Il fait partie de NHibernate.dll dans la version actuelle de NHibernate.