开发者

NHibernate dehydration

开发者 https://www.devze.com 2023-03-12 16:36 出处:网络
开发者_C百科Is there a way with NHibernate to take an instance of some mapped type and dehydrate it to an object[] that corresponds to the columns of the database if this instance were to be persisted

开发者_C百科Is there a way with NHibernate to take an instance of some mapped type and dehydrate it to an object[] that corresponds to the columns of the database if this instance were to be persisted in the database?


it would be helpful to know your use case. Maybe there is a better way to solve it but here goes what you requested:

var persistor = session.GetSessionImplementation().GetEntityPersister(obj.GetType().Name, obj);
object[] values = persistor.GetPropertyValues(obj, NHibernate.EntityMode.Poco);
0

精彩评论

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