views:

216

answers:

1

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.

+2  A: 

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

asgerhallas