简体   繁体   中英

How do I serialize an NHibernate DetachedCriteria object?

I am looking for a solution to persist NHibernate DetachedCriteria objects to a database. I have tracked down the NHibernateUtil and the GetSerializable method, but I'm unsure how to use it to serialize a DetachedCriteria object. Any help on this would be greatly appreciated. Thank you.

DetachedCriteria is serializable and because it is not connected to a session, it should be doable by just doing regular .net object serialization as described here:

http://msdn.microsoft.com/en-us/library/ms973893.aspx

If serialized to a binary format it could be persisted as byte-array to a binary blob field (NHibernateUtil.BinaryBlob.SqlType).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM