我有一个"Estate"实体,这个实体有一个集合"EstateFeatures"(类型:EstateFeature),而EstateFeature有一个属性"MyFeatureValue".
注意:这些是问题的有限属性.所有实体都有Id和所有necesarry等
房地产
IListEstateFeatures;
EstateFeature
FeatureValue MyFeatureValue;
FeatureValue
public virtual long Id;
我正在尝试获得具有给定FeatureValue.Id的Real Estates
DetachedCriteria query = DetachedCriteria.For(); Conjunction and = new Conjuction(); foreach (var id in idCollection) and.Add(Expression.Eq("MyFeatureValue.Id",id); query .CreateCriteria("EstateFeatures") .Add(and); IList estates = query.GetExecutableCriteria(session).List ();
这个查询没有返回任何内容,我做错了什么?
谢谢
如果我理解正确,我认为这样的事情可能有用
CreateCriteria(typeof(Estate)) .CreateAlias("EstateFeatures", "estatefeature") .Add(Restrictions.In("estatefeature.MyFeatureValue.Id", ids)) .List();