开发者

Temp modification of NHibernate Entities

Is there a way I can tell Nhibernate to ignore any future changes on a set of objects retrieved using it?

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)
}


You can evict the objects from the session. See the method ISession.Evict.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜