How do I serialize an NHibernate DetachedCriteria object?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-23 06:45:41

问题


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.


回答1:


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



来源:https://stackoverflow.com/questions/1245985/how-do-i-serialize-an-nhibernate-detachedcriteria-object

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!