NHibernate dehydration
开发者_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);
精彩评论