I am trying to serialize a DetachedCriteria so I can save it in a database and reuse the same criteria at a later date. When I run the code below I get "NHibernate.Criterion.DetachedCriteria cannot be serialized because it does not have a parameterless constructor".
DetachedCriteria criteria1 = DetachedCriteria.For<SecurityObjectDTO>("so")
.Add(Expression.Eq("ObjectCode", "1234"));
XmlSerializer s = new XmlSerializer(typeof(DetachedCriteria));
TextWriter writer = new StringWriter();
s.Serialize(writer, criteria1);
writer.Close();
Is there any good way to serialize a DetachedCriteria?