【发布时间】:2012-03-05 16:04:19
【问题描述】:
我正在迁移这样的应用程序:
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);
}
我不想做这样的事情:
session.EvictAllByType(typeof(Vehicle));
有可能吗?如何?, 谢谢
【问题讨论】:
-
您可以随时使用
session.Clear()来清理会话。 -
session.clear() 清除所有会话对象我只需要清除车辆类型对象,thanx
标签: c# nhibernate session isession