Example #1
0
        public void AddCustom(IList <ExprNode> indexExpressions, String operationName, int expressionPosition, ExprNode expression)
        {
            // find existing custom-entry for same index expressions
            QueryGraphValueEntryCustom found = null;

            foreach (QueryGraphValueDesc desc in _items)
            {
                if (desc.Entry is QueryGraphValueEntryCustom)
                {
                    if (ExprNodeUtility.DeepEquals(desc.IndexExprs, indexExpressions, true))
                    {
                        found = (QueryGraphValueEntryCustom)desc.Entry;
                        break;
                    }
                }
            }

            if (found == null)
            {
                found = new QueryGraphValueEntryCustom();
                _items.Add(new QueryGraphValueDesc(indexExpressions, found));
            }

            // find/create operation against the indexed fields
            QueryGraphValueEntryCustomKey       key = new QueryGraphValueEntryCustomKey(operationName, indexExpressions);
            QueryGraphValueEntryCustomOperation op  = found.Operations.Get(key);

            if (op == null)
            {
                op = new QueryGraphValueEntryCustomOperation();
                found.Operations.Put(key, op);
            }

            op.PositionalExpressions.Put(expressionPosition, expression);
        }
Example #2
0
 public bool Equals(QueryGraphValueEntryCustomKey other)
 {
     if (ReferenceEquals(null, other))
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     return(Equals(other._operationName, _operationName) &&
            ExprNodeUtility.DeepEquals(_exprNodes, other._exprNodes, true));
 }