public AqlQueryable <T> Query <T>() { var queryParser = LinqUtility.CreateQueryParser(); var executer = new AqlQueryExecuter(this); return(new AqlQueryable <T>(queryParser, executer, this)); }
public TraversalClause(Expression startVertex, Expression targetVertex, string identifier) : this(startVertex, identifier) { LinqUtility.CheckNotNull("tagetVertex", targetVertex); TargetVertex = targetVertex; }
public override Expression Resolve(ParameterExpression inputParameter, Expression expressionToBeResolved, ClauseGenerationContext clauseGenerationContext) { LinqUtility.CheckNotNull("inputParameter", inputParameter); LinqUtility.CheckNotNull("expressionToBeResolved", expressionToBeResolved); return(Source.Resolve(inputParameter, expressionToBeResolved, clauseGenerationContext)); }
public static IEnumerable <Warning> Warnings(FlowGraph graph, IEnumerable <IUnitPortDefinition> definitions = null) { if (definitions == null) { definitions = LinqUtility.Concat <IUnitPortDefinition>(graph.controlInputDefinitions, graph.controlOutputDefinitions, graph.valueInputDefinitions, graph.valueOutputDefinitions); } var hasDuplicate = definitions.DistinctBy(d => d.key).Count() != definitions.Count(); if (hasDuplicate) { yield return(Warning.Caution("Some port definitions with non-unique keys are currently ignored.")); } foreach (var definition in definitions) { if (!definition.isValid) { yield return(InvalidWarning(definition)); } } }
public LetSelectExpressionNode(MethodCallExpressionParseInfo parseInfo, LambdaExpression selector) : base(LinqUtility.CheckNotNull("parseInfo", parseInfo), LinqUtility.CheckNotNull("selector", selector)) { // Heuristically detect "let" constructs // Assume a Select call is a "let" construct if its selector looks like this: <x> => new { <x> = <x>, <y> = ... } var selectorBody = selector.Body as NewExpression; if (selectorBody != null && selectorBody.Arguments.Count == 2 && selectorBody.Arguments[0] == selector.Parameters[0] //&& selectorBody.Constructor.DeclaringType.IsDefined(typeof(CompilerGeneratedAttribute), false) && selectorBody.Members != null && selectorBody.Members.Count == 2) { _letConstruction = selectorBody; _resolvedAdaptedSelector = new ResolvedExpressionCache <Expression>(this); _resolvedLetExpression = new ResolvedExpressionCache <Expression>(this); } else { _letConstruction = null; _resolvedAdaptedSelector = null; _resolvedLetExpression = null; } }
T GetConstantValueFromExpression <T>(string expressionName, Expression expression) { LinqUtility.CheckNotNull("expression", expression); if (!typeof(T).GetTypeInfo().IsAssignableFrom(expression.Type.GetTypeInfo())) { var message = string.Format( "The value stored by the {0} expression ('{1}') is not of type '{2}', it is of type '{3}'.", expressionName, expression.ToString(), typeof(T), expression.Type); throw new ArgumentException(message, "expression"); } var itemAsConstantExpression = expression as ConstantExpression; if (itemAsConstantExpression != null) { return((T)itemAsConstantExpression.Value); } else { var message = string.Format( "The {0} expression ('{1}') is no ConstantExpression, it is a {2}.", expressionName, expression.ToString(), expression.GetType().Name); throw new ArgumentException(message, "expression"); } }
public virtual void TransformExpressions(Func <Expression, Expression> transformation) { LinqUtility.CheckNotNull("transformation", transformation); SearchSelector = transformation(SearchSelector); InsertSelector = transformation(InsertSelector); UpdateSelector = transformation(UpdateSelector); }
public FilterClause Clone(CloneContext cloneContext) { LinqUtility.CheckNotNull("cloneContext", cloneContext); var clone = new FilterClause(Predicate); return(clone); }
public LetClause(string itemName, Expression letExpression) { LinqUtility.CheckNotNull("itemName", itemName); LinqUtility.CheckNotNull("letExpression", letExpression); _itemName = itemName; _letExpression = letExpression; }
protected override void ApplyNodeSpecificSemantics(QueryModel queryModel, ClauseGenerationContext clauseGenerationContext) { LinqUtility.CheckNotNull("queryModel", queryModel); var clause = new FilterClause(GetResolvedPredicate(clauseGenerationContext)); queryModel.BodyClauses.Add(clause); }
public virtual SkipTakeClause Clone(CloneContext cloneContext) { LinqUtility.CheckNotNull("cloneContext", cloneContext); var clone = new SkipTakeClause(SkipCount, TakeCount); return(clone); }
public RemoveClause Clone(CloneContext cloneContext) { LinqUtility.CheckNotNull("cloneContext", cloneContext); var result = new RemoveClause(ItemName, CollectionType, KeySelector); return(result); }
public UpdateReplaceClause Clone(CloneContext cloneContext) { LinqUtility.CheckNotNull("cloneContext", cloneContext); var result = new UpdateReplaceClause(WithSelector, ItemName, CollectionType, KeySelector, Command); return(result); }
protected override void ApplyNodeSpecificSemantics(QueryModel queryModel, ClauseGenerationContext clauseGenerationContext) { LinqUtility.CheckNotNull("queryModel", queryModel); var modificationClause = queryModel.BodyClauses.NextBodyClause <IModificationClause>(); modificationClause.IgnoreSelect = true; }
protected override void ApplyNodeSpecificSemantics(QueryModel queryModel, ClauseGenerationContext clauseGenerationContext) { LinqUtility.CheckNotNull("queryModel", queryModel); var traversalClause = queryModel.BodyClauses.Last(b => b is ITraversalClause) as ITraversalClause; traversalClause.Options = Options; }
public UpsertClause Clone(CloneContext cloneContext) { LinqUtility.CheckNotNull("cloneContext", cloneContext); var result = new UpsertClause(SearchSelector, InsertSelector, UpdateSelector, ItemName, CollectionType); return(result); }
public virtual TraversalClause Clone(CloneContext cloneContext) { LinqUtility.CheckNotNull("cloneContext", cloneContext); var clone = new TraversalClause(StartVertex, Identifier); return(clone); }
protected override void ApplyNodeSpecificSemantics(QueryModel queryModel, ClauseGenerationContext clauseGenerationContext) { LinqUtility.CheckNotNull("queryModel", queryModel); var modificationClause = queryModel.BodyClauses.NextBodyClause <IModificationClause>(0); modificationClause.CollectionType = CollectionToModify; }
public InsertClause Clone(CloneContext cloneContext) { LinqUtility.CheckNotNull("cloneContext", cloneContext); var result = new InsertClause(WithSelector, ItemName, CollectionType); return(result); }
public GroupByClause Clone(CloneContext cloneContext) { LinqUtility.CheckNotNull("cloneContext", cloneContext); var clone = new GroupByClause(Selector, lambdaSelector, intoIdentifier); return(clone); }
public void TransformExpressions(Func <Expression, Expression> transformation) { LinqUtility.CheckNotNull("transformation", transformation); if (SkipCount != null) { SkipCount = transformation(SkipCount); } TakeCount = transformation(TakeCount); }
public void TransformExpressions(Func <Expression, Expression> transformation) { LinqUtility.CheckNotNull("transformation", transformation); StartVertex = transformation(StartVertex); if (TargetVertex != null) { TargetVertex = transformation(TargetVertex); } }
public override Expression Resolve( ParameterExpression inputParameter, Expression expressionToBeResolved, ClauseGenerationContext clauseGenerationContext) { LinqUtility.CheckNotNull("inputParameter", inputParameter); LinqUtility.CheckNotNull("expressionToBeResolved", expressionToBeResolved); // this simply streams its input data to the output without modifying its structure, so we resolve by passing on the data to the previous node return(Source.Resolve(inputParameter, expressionToBeResolved, clauseGenerationContext)); }
protected override void ApplyNodeSpecificSemantics(QueryModel queryModel, ClauseGenerationContext clauseGenerationContext) { LinqUtility.CheckNotNull("queryModel", queryModel); queryModel.BodyClauses.Add(new RemoveClause( queryModel.MainFromClause.ItemName, (Type)Collection.Value, KeySelector != null ? GetResolvedKeyPredicate(clauseGenerationContext) : null)); }
protected override void ApplyNodeSpecificSemantics(QueryModel queryModel, ClauseGenerationContext clauseGenerationContext) { LinqUtility.CheckNotNull("queryModel", queryModel); queryModel.BodyClauses.Add(new UpdateReplaceClause(GetResolvedPredicate(clauseGenerationContext), queryModel.MainFromClause.ItemName, WithSelector.Parameters[0].Type, KeySelector != null ? GetResolvedKeyPredicate(clauseGenerationContext) : null, Command.Value.ToString())); }
public TraversalClause(Expression startVertex, string identifier) { LinqUtility.CheckNotNull("startVertex", startVertex); LinqUtility.CheckNotNull("identifier", identifier); EdgeCollections = new List <TraversalEdgeDefinition>(); StartVertex = startVertex; Identifier = identifier; }
public override Expression Resolve(ParameterExpression inputParameter, Expression expressionToBeResolved, ClauseGenerationContext clauseGenerationContext) { LinqUtility.CheckNotNull("inputParameter", inputParameter); LinqUtility.CheckNotNull("expressionToBeResolved", expressionToBeResolved); var resolvedSelector = GetResolvedAdaptedSelector(clauseGenerationContext); var resolved = ReplacingExpressionVisitor.Replace(inputParameter, Expression.Parameter(resolvedSelector.Type, identifier), expressionToBeResolved); return(resolved); }
public override Expression Resolve( ParameterExpression inputParameter, Expression expressionToBeResolved, ClauseGenerationContext clauseGenerationContext) { LinqUtility.CheckNotNull("inputParameter", inputParameter); LinqUtility.CheckNotNull("expressionToBeResolved", expressionToBeResolved); // we modify the structure of the stream of data coming into this node by our selector, // so we first resolve the selector, then we substitute the result for the inputParameter in the expressionToBeResolved var resolvedSelector = GetResolvedSelector(clauseGenerationContext); return(ReplacingExpressionVisitor.Replace(inputParameter, resolvedSelector, expressionToBeResolved)); }
protected override void ApplyNodeSpecificSemantics(QueryModel queryModel, ClauseGenerationContext clauseGenerationContext) { LinqUtility.CheckNotNull("queryModel", queryModel); queryModel.BodyClauses.Add(new UpsertClause( GetResolvedSearchPredicate(clauseGenerationContext), GetResolvedInsertPredicate(clauseGenerationContext), GetResolvedUpdatePredicate(clauseGenerationContext), queryModel.MainFromClause.ItemName, UpdateType.Value as Type )); }
protected override void ApplyNodeSpecificSemantics(QueryModel queryModel, ClauseGenerationContext clauseGenerationContext) { LinqUtility.CheckNotNull("queryModel", queryModel); var traversalClause = new TraversalClause(StartVertex, identifier); queryModel.BodyClauses.Add(traversalClause); clauseGenerationContext.AddContextInfo(this, traversalClause); //queryModel.SelectClause.Selector = GetResolvedAdaptedSelector(clauseGenerationContext); }