本文整理汇总了C#中QueryBuilder.NewSubQueryBuilder方法的典型用法代码示例。如果您正苦于以下问题:C# QueryBuilder.NewSubQueryBuilder方法的具体用法?C# QueryBuilder.NewSubQueryBuilder怎么用?C# QueryBuilder.NewSubQueryBuilder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QueryBuilder
的用法示例。
在下文中一共展示了QueryBuilder.NewSubQueryBuilder方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddToQuery
public void AddToQuery(AuditConfiguration auditCfg, String entityName, QueryBuilder qb, Parameters parameters)
{
String propertyName = propertyNameGetter.Get(auditCfg);
CriteriaTools.CheckPropertyNotARelation(auditCfg, entityName, propertyName);
// This will be the aggregated query, containing all the specified conditions
QueryBuilder subQb = qb.NewSubQueryBuilder();
// Adding all specified conditions both to the main query, as well as to the
// aggregated one.
foreach (IAuditCriterion versionsCriteria in criterions) {
versionsCriteria.AddToQuery(auditCfg, entityName, qb, parameters);
versionsCriteria.AddToQuery(auditCfg, entityName, subQb, subQb.RootParameters);
}
// Setting the desired projection of the aggregated query
switch (mode) {
case AggregatedMode.MIN:
subQb.AddProjection("min", propertyName, false);
break;
case AggregatedMode.MAX:
subQb.AddProjection("max", propertyName, false);
break;
}
// Adding the constrain on the result of the aggregated criteria
parameters.AddWhere(propertyName, "=", subQb);
}