1
这里是我的域模型的一小摘录:查询过一种不同的实体
public class Chain
{
public IList<Product> Products { get; set; }
}
public class Store
{
public Chain Chain { get; set; }
public IList<Product> Products { get; set; }
}
现在我需要在Store
和相关Chain
创造了Product
查询。 问题是如何扩展存储在所有者Chain
中的产品的查询?
这是我到目前为止有:
var subQuery = QueryOver.Of<Store>()
.Where(s => s.Id == searchCriteria.StoreId)
.Select(s => s.Id);
Store storeAlias = null;
var query = _session.QueryOver<Product>()
.JoinAlias(p => p.Stores,() => storeAlias)
.WithSubquery.WhereProperty(() => storeAlias.Id).In(subQuery);
//// some more clauses...
我怎样才能做到这一点? 请注意:Chain
物业Store
可能是null
。
这将是*更*有益的,如果你可以的,你要查询的,而不是描述QueryOver什么纯英文定义查询。 – frictionlesspulley 2013-04-07 15:51:13
奥克我试图把重点放在更具体的问题上。我希望我的问题现在变得更加清晰。 – core 2013-04-08 18:15:19
如果您可以指定查询尝试执行的示例,那肯定会有所帮助。 – frictionlesspulley 2013-04-08 18:24:51