我遷移這樣的應用程序:NHibernate的集中退出按類型而不是按實例
Vehicle v = null;
using (ISession session = MyNHibernateSession())
{
v = Vehicle.FindById(1);
}
using (ISession session = MyNHibernateSession())
{
// somwwhere into these4 lines Vehicle comes Finded
DoSomething();
DoSomething2();
DoSomething3();
DoSomething4();
DoSomething5();
DoSomething6();
// if i do this i get an error "another object with the same id etc etc etc
session.Update(v);
}
我wan't做這樣的事情:
session.EvictAllByType(typeof(Vehicle));
這可能嗎?如何?, 謝謝
你總是可以做一個'session.Clear()'清理會話。 – 2012-03-05 18:16:27
session.clear()清除所有需要清除車輛類型對象的會話對象,thanx – manuellt 2012-03-06 08:40:25