protected override void OnParsing(XElement existingQuery) { var existingClauses = existingQuery.Elements().Select(CamlClause.GetClause).ToList(); Where = existingClauses.OfType<CamlWhere>().FirstOrDefault(); OrderBy = existingClauses.OfType<CamlOrderBy>().FirstOrDefault(); GroupBy = existingClauses.OfType<CamlGroupBy>().FirstOrDefault(); }
public static CamlWhere And(this CamlWhere firstWhere, CamlWhere secondWhere) { if (firstWhere == null) throw new ArgumentNullException("firstWhere"); if (secondWhere == null) throw new ArgumentNullException("secondWhere"); var logicalJoin = firstWhere.Operator as LogicalJoin; var @where = logicalJoin != null ? new CamlWhere(logicalJoin.CombineAnd(secondWhere.Operator)) : new CamlWhere(firstWhere.Operator.And(secondWhere.Operator)); return where; }
public static CamlWhere And(this CamlWhere where, params Operator[] operators) { if (where == null) throw new ArgumentNullException(nameof(@where)); if (operators.Length > 0) { Operator @operator = operators.Where(op => op != null) .Aggregate(@where.Operator, (current, op) => current.And(op)); where = new CamlWhere(@operator); } return where; }