gpt4 book ai didi

.net - 我可以从 NHibernate session 中分离一个对象吗?

转载 作者:行者123 更新时间:2023-12-03 12:31:17 24 4
gpt4 key购买 nike

如果我已经通过 NHibernate 的 Get() 或 Load() 方法从数据库中获取了一个持久对象,有没有办法让我将该对象从其 NHibernate session 中分离出来,这样对其所做的更改就不会自动持久化?

最佳答案

试试 Session 的 Evict 方法。

Changes to the instance will not be synchronized with the database. This operation cascades to associated instances if the association is mapped with cascade="all" or cascade="all-delete-orphan".

关于.net - 我可以从 NHibernate session 中分离一个对象吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1059221/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com