NHibernate实体的临时修改

时间:2010-12-30 23:46:40

标签: c# nhibernate

有没有办法告诉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)
}

1 个答案:

答案 0 :(得分:2)

您可以从会话中逐出对象。请参阅方法ISession.Evict