I normally query interfaces using DetachedCriteria in NHibernate:
DetachedCriteria crit = DetachedCriteria.For<IParent>();
And this works fine.
I now want to create a subquery for a child object thus:
DetachedCriteria subcrit = DetachedCriteria.For<IChild>();
and add it to the criteria like this (kind of, p.Child is actually an alias but I've simplified):
crit.Add(LambdaSubquery.Property<IParent>(p => p.Child.ChildID).In(subcrit));
This works if my DetchedCriteria is for a Child:
DetachedCriteria subcrit = DetachedCriteria.For<Child>();
but not it it's for the interface (as above). In that instance I get an exception:
NHibernate.MappingException: No persister for: Domain.Name.Space.IChild
Is this something that's meant to be or am I missing some config?