I'm migrating an application like this:
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);
}
I wan't to do something like this:
session.EvictAllByType(typeof(Vehicle));
is it possible? how?, thanks
IMHO I don't think evict is the solution in your case since the v doesn't belong to the 2nd session (so if you evict all vehicles is not enough).
My suggestion is to attach v to the second session like: