Selecting objects not in a collection in NHibernate with ICriteria Interface?

This is off the top of my head, but might be a useful pointer.

This is off the top of my head, but might be a useful pointer. Var crit = _session. CreateCriteria("c") .

Add( Subqueries. PropertyNotIn("c. Id", DetachedCriteria.

For("u") . CreateCriteria("Categories","uc") . SetProjection(Projections.

Property("uc. Id")) )); var unassignedCategories = crit.List(); You can probably get a feel for the SQL that will be generated here: select c. * from categories where c.Id not in (select uc.

Id from usercategories) Hope this helps, and sorry I haven't been able to test it :) Tobin.

Brilliant, worked first time. – Richard Feb 17 '10 at 11:16.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions