views:

33

answers:

1

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

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

A: 

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

Floyd