internal QueryExpression(bool Negated, ExpressionType Type, string FieldName, Operator? Operator, string Value, QueryExpression LeftExpression, QueryOperand Operand, QueryExpression RightExpression) { this.Negated = Negated; this.Type = Type; this.FieldName = FieldName; this.Operator = Operator; this.Value = Value; this.LeftExpression = LeftExpression; this.Operand = Operand; this.RightExpression = RightExpression; }
private string GetOperandComparisonString(QueryOperand operand, object value) { if (operand == QueryOperand.DueDate && value != null) { return($"{_itemParameter}.DueDate.HasValue && {_itemParameter}.DueDate.Value.Date"); } else { return(GetOperandString(operand)); } }
private string GetOperandString(QueryOperand operand) { switch (operand) { case QueryOperand.DueDate: return($"{_itemParameter}.DueDate"); case QueryOperand.Important: return($"{_itemParameter}.Important"); case QueryOperand.Done: return($"{_itemParameter}.Done"); default: throw new InvalidOperationException("Invalid operand."); } }
private void AppendQueryOperand(QueryOperand operand) { _lastUnaryModifier = null; if (_queryTree == null) { _queryTree = new QueryTree(operand); _lastOperandNode = _queryTree.Root; return; } if (_lastOperandNode.Left == null) { _lastOperandNode = _lastOperandNode.SetLeft(operand); return; } if (_lastOperandNode.Right == null) { _lastOperandNode = _lastOperandNode.SetRight(operand); return; } }
public override Object Visit(QueryOperand operand) { return base.Visit(operand); }
/// <contentfrom cref="IQueryCriteriaVisitor.Visit(QueryOperand)" /> object IQueryCriteriaVisitor.Visit(QueryOperand operand) { bool isCustom = customAliases != null && customAliases.Contains(operand.NodeAlias ?? string.Empty); if (isCustom) return formatterSequred.FormatCustomColumn(operand.ColumnName, operand.NodeAlias); string columnName = formatter.ComposeSafeColumnName(operand.ColumnName); return operand.NodeAlias == null ? formatter.FormatColumn(columnName) : formatter.FormatColumn(columnName, operand.NodeAlias); }
/// <contentfrom cref="IQueryCriteriaVisitor.Visit(QueryOperand)"/> object IQueryCriteriaVisitor.Visit(QueryOperand theOperand) { keyProcessed.Add(theOperand.ColumnName); return formatter.FormatColumn(theOperand.ColumnName); }
/// <contentfrom cref="IQueryCriteriaVisitor.Visit(QueryOperand)"/> object IQueryCriteriaVisitor.Visit(QueryOperand theOperand) { return formatter.FormatColumn(formatter.ComposeSafeColumnName(theOperand.ColumnName)); }
/// <contentfrom cref="IQueryCriteriaVisitor.Visit(QueryOperand)"/> public object Visit(QueryOperand theOperand) { string alias = theOperand.NodeAlias ?? string.Empty; if (tables.ContainsKey(alias)) { Tuple<DBTableEx, DBTableEx> replace = tables[alias]; int columnIndex = replace.Item1.Columns.FindIndex(col => col.Name == theOperand.ColumnName); if (columnIndex >= 0 && columnIndex < replace.Item2.Columns.Count) { DBColumn column = replace.Item2.Columns[columnIndex]; if (column is DBCriteriaColumn) return ((DBCriteriaColumn)column).GetCriteria(theOperand.NodeAlias); return new QueryOperand(column.Name, theOperand.NodeAlias, theOperand.ColumnType); } else throw new InvalidOperationException(string.Format( "Query with custom persistent table {0}. Column index {1} is out of range", replace.Item1.Name, columnIndex)); } return theOperand; }
/// <contentfrom cref="IQueryCriteriaVisitor.Visit(QueryOperand)"/> public object Visit(QueryOperand theOperand) { theOperand.NodeAlias = ProcessAlias(theOperand.NodeAlias); return null; }
object IQueryCriteriaVisitor.Visit(QueryOperand theOperand){ return theOperand; }
internal QueryExpression(QueryExpression FirstExpression, QueryOperand Operand, QueryExpression SecondExpression) { this.Type = ExpressionType.Complex; this.LeftExpression = FirstExpression; this.Operand = Operand; this.RightExpression = SecondExpression; }
CriteriaOperator IQueryCriteriaVisitor <CriteriaOperator> .Visit(QueryOperand theOperand) { return(theOperand); }
object IQueryCriteriaVisitor.Visit(QueryOperand theOperand) { return(theOperand); }
void ApplyCondition(SelectStatement statement, FilterProviderBase providerBase, string nodeAlias) { var objectType = GetObjectType(statement.TableName); if (FilteredByKey(statement, objectType)) return; CriteriaOperator condition = null; if (providerBase.FilterValue is IList) { CriteriaOperator criteriaOperator = ((IEnumerable)providerBase.FilterValue).Cast<object>().Aggregate<object, CriteriaOperator>(null, (current, value) => current | ( value == null ? (CriteriaOperator)new QueryOperand(providerBase.FilterMemberName, nodeAlias).IsNull() : new QueryOperand(providerBase.FilterMemberName, nodeAlias) == new OperandValue( value))); criteriaOperator = new GroupOperator(criteriaOperator); condition = criteriaOperator; } else condition = new QueryOperand(providerBase.FilterMemberName, nodeAlias) == (providerBase.FilterValue == null ? null : providerBase.FilterValue.ToString()); if (objectType != null) { var typeInfo = XafTypesInfo.CastTypeToTypeInfo(objectType); if (typeInfo.OwnMembers.FirstOrDefault(x=>x.Name == "ObjectType") != null) { var excludes = new List<Type>(); foreach (var item in _BaseTypesDictionary.Where(x => x.Value == typeInfo).Select(x => x.Key)) { if (FilterProviderManager.GetFilterProvider(item.Type,providerBase.FilterMemberName,StatementContext.Select) == null) excludes.Add(item.Type); } if (excludes.Count > 0) { var table = XafTypesInfo.XpoTypeInfoSource.GetEntityClassInfo(typeof(XPObjectType)).Table; statement.SubNodes.Add(new JoinNode(table,"OT",JoinType.Inner){Condition = new QueryOperand("ObjectType",statement.Alias) == new QueryOperand("OId","OT")}); condition |= new InOperator(new QueryOperand("TypeName","OT"),excludes.Select(x=>new OperandValue( x.FullName)).ToArray()); } } } statement.Condition &= new GroupOperator(condition); }
public object Visit(QueryOperand theOperand) { return null; }