必须使用的dll是什么?我在哪里可以买到它?
我正在使用Nhibernate,我可以将它与NHibernate一起使用吗?
答案 0 :(得分:1)
BeginTransaction()是NHibernate会话的一个方法。它是当前版本的NHibernate中NHibernate.dll的一部分。
答案 1 :(得分:0)
来源: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