有没有办法告诉Nhibernate忽略使用它检索的一组对象的未来变化?
public ReturnedObject DoIt()
{
List<MySuperDuperObject> awesomes = repository.GetMyAwesomenesObjects();
var sp = new SuperParent();
BusinessObjectWithoutNHibernateAccess.ProcessThese(i, awesomes,sp)
repository.save(sp);
return i;
}
public ReturnedObject FakeIt()
{
List<MySuperDuperObject> awesomes = repository.GetMyAwesomenesObjects();
var sp = new SuperParent();
// should something go here to tell NHibernate to ignore changes to awesomes and sp?
return BusinessObjectWithoutNHibernateAccess.ProcessThese(awesomes,sp)
}
答案 0 :(得分:2)
您可以从会话中逐出对象。请参阅方法ISession.Evict
。