Anyone know how to convert an ICriteria into a DetachedCriteria. I need to use an existing ICriteria as part of a subquery using:
.Add(Subqueries.PropertyIn("Name", myDetachedCriteriaSubquery))
Is there any way to convert an ICriteria to a DetachedCriteria. I will accept 'no' with a credible reference.
Following on from mattk's answer, you can inherit DetachedCriteria to access its constructors:
Now you can write code like this:
Disclaimer: I've only subject this to minimal testing in NH 2... no guarantees it will work or be of any use.
if Your criteria session null , create "object referans.." exception.
use
CriteriaTransformer.Clone(criteria)
DetachedCriteria has a constructor which takes an ICriteria but it is internal. It is used by CriteriaTransformer. Perhaps you could implement something similar?