NHIbernate查询标准和任何条款
我的子查询中有以下内容失败:NHIbernate查询标准和任何条款,nhibernate,Nhibernate,我的子查询中有以下内容失败: var subquery = QueryOver.Of<Product>() .Where(x => x.ProductCategories.Any(y => y.Categgory == parameter.Category)); 我如何更新上述QueryOver限制 ProductCategory productCategory = null; var subquery = QueryOver.Of<
var subquery = QueryOver.Of<Product>()
.Where(x => x.ProductCategories.Any(y => y.Categgory == parameter.Category));
我如何更新上述QueryOver限制
ProductCategory productCategory = null;
var subquery = QueryOver.Of<Product>()
.JoinAlias(product => product.ProductCategories, () => productCategory)
.Where(() => productCategory.Category.Id == parameter.Category.Id);
如果这是基本属性:
productCategory.Category == parameter.Category
是多对多关系吗?(产品及类别)
Category-Category=null;
var subquery=QueryOver.Of()
.JoinAlias(product=>product.Category,()=>Category)
其中(()=>category.Id==parameter.category.Id);
ProductCategory ProductCategory=null;
var subquery=QueryOver.Of()
.JoinAlias(product=>product.ProductCategories,()=>ProductCategories)
.Where(子查询.WhereExists(CatExistsQuery())
private QueryOver CatExistsQuery(参数)
{
ProductCategory\u innerCat=null;
var query=(QueryOver)会话
.QueryOver(()=>\u innerCat)
.Where(()=>\u productCategory.Id==\u innerCat.Id)
.And(innerCat.Id==parameter.Category.Id)
返回查询;
}
productCategory.Category.Id == parameter.Category.Id
productCategory.Category == parameter.Category
Category category = null;
var subquery = QueryOver.Of<Product>()
.JoinAlias(product => product.Category, () => category)
.Where(() => category.Id == parameter.Category.Id);
ProductCategory productCategory = null;
var subquery = QueryOver.Of<Product>()
.JoinAlias(product => product.ProductCategories, () => productCategory)
.Where(Subqueries.WhereExists(CatExistsQuery())
private QueryOver<ProductCategory , ProductCategory > CatExistsQuery(<your type> parameter)
{
ProductCategory _innerCat = null;
var query = (QueryOver<ProductCategory , ProductCategory >)Session
.QueryOver(() => _innerCat )
.Where(() => _productCategory.Id== _innerCat.Id)
.And (innerCat.Id == parameter.Category.Id)
return query ;
}