System\Data\Common\CommandTrees\DbLambda.cs (190)
28private readonly DbExpression _body;
30internal DbLambda(ReadOnlyVariables variables, DbExpression bodyExp)
40/// Gets the <see cref="DbExpression"/> that provides the definition of the Lambda function
42public DbExpression Body { get { return this._body; } }
64public static DbLambda Create(DbExpression body, IEnumerable<DbVariableReferenceExpression> variables)
84public static DbLambda Create(DbExpression body, params DbVariableReferenceExpression[] variables)
93/// <param name="lambdaFunction">A function that defines the logic of the Lambda function as a <see cref="DbExpression"/></param>
98public static DbLambda Create(TypeUsage argument1Type, Func<DbExpression, DbExpression> lambdaFunction)
104DbExpression body = lambdaFunction(variables[0]);
114/// <param name="lambdaFunction">A function that defines the logic of the Lambda function as a <see cref="DbExpression"/></param>
120public static DbLambda Create(TypeUsage argument1Type, TypeUsage argument2Type, Func<DbExpression, DbExpression, DbExpression> lambdaFunction)
127DbExpression body = lambdaFunction(variables[0], variables[1]);
138/// <param name="lambdaFunction">A function that defines the logic of the Lambda function as a <see cref="DbExpression"/></param>
144public static DbLambda Create(TypeUsage argument1Type, TypeUsage argument2Type, TypeUsage argument3Type, Func<DbExpression, DbExpression, DbExpression, DbExpression> lambdaFunction)
152DbExpression body = lambdaFunction(variables[0], variables[1], variables[2]);
164/// <param name="lambdaFunction">A function that defines the logic of the Lambda function as a <see cref="DbExpression"/></param>
170public static DbLambda Create(TypeUsage argument1Type, TypeUsage argument2Type, TypeUsage argument3Type, TypeUsage argument4Type, Func<DbExpression, DbExpression, DbExpression, DbExpression, DbExpression> lambdaFunction)
179DbExpression body = lambdaFunction(variables[0], variables[1], variables[2], variables[3]);
192/// <param name="lambdaFunction">A function that defines the logic of the Lambda function as a <see cref="DbExpression"/></param>
198public static DbLambda Create(TypeUsage argument1Type, TypeUsage argument2Type, TypeUsage argument3Type, TypeUsage argument4Type, TypeUsage argument5Type, Func<DbExpression, DbExpression, DbExpression, DbExpression, DbExpression, DbExpression> lambdaFunction)
208DbExpression body = lambdaFunction(variables[0], variables[1], variables[2], variables[3], variables[4]);
222/// <param name="lambdaFunction">A function that defines the logic of the Lambda function as a <see cref="DbExpression"/></param>
229public static DbLambda Create(TypeUsage argument1Type, TypeUsage argument2Type, TypeUsage argument3Type, TypeUsage argument4Type, TypeUsage argument5Type, TypeUsage argument6Type, Func<DbExpression, DbExpression, DbExpression, DbExpression, DbExpression, DbExpression, DbExpression> lambdaFunction)
240DbExpression body = lambdaFunction(variables[0], variables[1], variables[2], variables[3], variables[4], variables[5]);
255/// <param name="lambdaFunction">A function that defines the logic of the Lambda function as a <see cref="DbExpression"/></param>
262public static DbLambda Create(TypeUsage argument1Type, TypeUsage argument2Type, TypeUsage argument3Type, TypeUsage argument4Type, TypeUsage argument5Type, TypeUsage argument6Type, TypeUsage argument7Type, Func<DbExpression, DbExpression, DbExpression, DbExpression, DbExpression, DbExpression, DbExpression, DbExpression> lambdaFunction)
274DbExpression body = lambdaFunction(variables[0], variables[1], variables[2], variables[3], variables[4], variables[5], variables[6]);
290/// <param name="lambdaFunction">A function that defines the logic of the Lambda function as a <see cref="DbExpression"/></param>
297public static DbLambda Create(TypeUsage argument1Type, TypeUsage argument2Type, TypeUsage argument3Type, TypeUsage argument4Type, TypeUsage argument5Type, TypeUsage argument6Type, TypeUsage argument7Type, TypeUsage argument8Type, Func<DbExpression, DbExpression, DbExpression, DbExpression, DbExpression, DbExpression, DbExpression, DbExpression, DbExpression> lambdaFunction)
310DbExpression body = lambdaFunction(variables[0], variables[1], variables[2], variables[3], variables[4], variables[5], variables[6], variables[7]);
327/// <param name="lambdaFunction">A function that defines the logic of the Lambda function as a <see cref="DbExpression"/></param>
335public static DbLambda Create(TypeUsage argument1Type, TypeUsage argument2Type, TypeUsage argument3Type, TypeUsage argument4Type, TypeUsage argument5Type, TypeUsage argument6Type, TypeUsage argument7Type, TypeUsage argument8Type, TypeUsage argument9Type, Func<DbExpression, DbExpression, DbExpression, DbExpression, DbExpression, DbExpression, DbExpression, DbExpression, DbExpression, DbExpression> lambdaFunction)
349DbExpression body = lambdaFunction(variables[0], variables[1], variables[2], variables[3], variables[4], variables[5], variables[6], variables[7], variables[8]);
367/// <param name="lambdaFunction">A function that defines the logic of the Lambda function as a <see cref="DbExpression"/></param>
375public static DbLambda Create(TypeUsage argument1Type, TypeUsage argument2Type, TypeUsage argument3Type, TypeUsage argument4Type, TypeUsage argument5Type, TypeUsage argument6Type, TypeUsage argument7Type, TypeUsage argument8Type, TypeUsage argument9Type, TypeUsage argument10Type, Func<DbExpression, DbExpression, DbExpression, DbExpression, DbExpression, DbExpression, DbExpression, DbExpression, DbExpression, DbExpression, DbExpression> lambdaFunction)
390DbExpression body = lambdaFunction(variables[0], variables[1], variables[2], variables[3], variables[4], variables[5], variables[6], variables[7], variables[8], variables[9]);
409/// <param name="lambdaFunction">A function that defines the logic of the Lambda function as a <see cref="DbExpression"/></param>
417public static DbLambda Create(TypeUsage argument1Type, TypeUsage argument2Type, TypeUsage argument3Type, TypeUsage argument4Type, TypeUsage argument5Type, TypeUsage argument6Type, TypeUsage argument7Type, TypeUsage argument8Type, TypeUsage argument9Type, TypeUsage argument10Type, TypeUsage argument11Type, Func<DbExpression, DbExpression, DbExpression, DbExpression, DbExpression, DbExpression, DbExpression, DbExpression, DbExpression, DbExpression, DbExpression, DbExpression> lambdaFunction)
433DbExpression body = lambdaFunction(variables[0], variables[1], variables[2], variables[3], variables[4], variables[5], variables[6], variables[7], variables[8], variables[9], variables[10]);
453/// <param name="lambdaFunction">A function that defines the logic of the Lambda function as a <see cref="DbExpression"/></param>
462public static DbLambda Create(TypeUsage argument1Type, TypeUsage argument2Type, TypeUsage argument3Type, TypeUsage argument4Type, TypeUsage argument5Type, TypeUsage argument6Type, TypeUsage argument7Type, TypeUsage argument8Type, TypeUsage argument9Type, TypeUsage argument10Type, TypeUsage argument11Type, TypeUsage argument12Type, Func<DbExpression, DbExpression, DbExpression, DbExpression, DbExpression, DbExpression, DbExpression, DbExpression, DbExpression, DbExpression, DbExpression, DbExpression, DbExpression> lambdaFunction)
479DbExpression body = lambdaFunction(variables[0], variables[1], variables[2], variables[3], variables[4], variables[5], variables[6], variables[7], variables[8], variables[9], variables[10], variables[11]);
500/// <param name="lambdaFunction">A function that defines the logic of the Lambda function as a <see cref="DbExpression"/></param>
509public static DbLambda Create(TypeUsage argument1Type, TypeUsage argument2Type, TypeUsage argument3Type, TypeUsage argument4Type, TypeUsage argument5Type, TypeUsage argument6Type, TypeUsage argument7Type, TypeUsage argument8Type, TypeUsage argument9Type, TypeUsage argument10Type, TypeUsage argument11Type, TypeUsage argument12Type, TypeUsage argument13Type, Func<DbExpression, DbExpression, DbExpression, DbExpression, DbExpression, DbExpression, DbExpression, DbExpression, DbExpression, DbExpression, DbExpression, DbExpression, DbExpression, DbExpression> lambdaFunction)
527DbExpression body = lambdaFunction(variables[0], variables[1], variables[2], variables[3], variables[4], variables[5], variables[6], variables[7], variables[8], variables[9], variables[10], variables[11], variables[12]);
549/// <param name="lambdaFunction">A function that defines the logic of the Lambda function as a <see cref="DbExpression"/></param>
558public static DbLambda Create(TypeUsage argument1Type, TypeUsage argument2Type, TypeUsage argument3Type, TypeUsage argument4Type, TypeUsage argument5Type, TypeUsage argument6Type, TypeUsage argument7Type, TypeUsage argument8Type, TypeUsage argument9Type, TypeUsage argument10Type, TypeUsage argument11Type, TypeUsage argument12Type, TypeUsage argument13Type, TypeUsage argument14Type, Func<DbExpression, DbExpression, DbExpression, DbExpression, DbExpression, DbExpression, DbExpression, DbExpression, DbExpression, DbExpression, DbExpression, DbExpression, DbExpression, DbExpression, DbExpression> lambdaFunction)
577DbExpression body = lambdaFunction(variables[0], variables[1], variables[2], variables[3], variables[4], variables[5], variables[6], variables[7], variables[8], variables[9], variables[10], variables[11], variables[12], variables[13]);
600/// <param name="lambdaFunction">A function that defines the logic of the Lambda function as a <see cref="DbExpression"/></param>
610public static DbLambda Create(TypeUsage argument1Type, TypeUsage argument2Type, TypeUsage argument3Type, TypeUsage argument4Type, TypeUsage argument5Type, TypeUsage argument6Type, TypeUsage argument7Type, TypeUsage argument8Type, TypeUsage argument9Type, TypeUsage argument10Type, TypeUsage argument11Type, TypeUsage argument12Type, TypeUsage argument13Type, TypeUsage argument14Type, TypeUsage argument15Type, Func<DbExpression, DbExpression, DbExpression, DbExpression, DbExpression, DbExpression, DbExpression, DbExpression, DbExpression, DbExpression, DbExpression, DbExpression, DbExpression, DbExpression, DbExpression, DbExpression> lambdaFunction)
630DbExpression body = lambdaFunction(variables[0], variables[1], variables[2], variables[3], variables[4], variables[5], variables[6], variables[7], variables[8], variables[9], variables[10], variables[11], variables[12], variables[13], variables[14]);
654/// <param name="lambdaFunction">A function that defines the logic of the Lambda function as a <see cref="DbExpression"/></param>
664public static DbLambda Create(TypeUsage argument1Type, TypeUsage argument2Type, TypeUsage argument3Type, TypeUsage argument4Type, TypeUsage argument5Type, TypeUsage argument6Type, TypeUsage argument7Type, TypeUsage argument8Type, TypeUsage argument9Type, TypeUsage argument10Type, TypeUsage argument11Type, TypeUsage argument12Type, TypeUsage argument13Type, TypeUsage argument14Type, TypeUsage argument15Type, TypeUsage argument16Type, Func<DbExpression, DbExpression, DbExpression, DbExpression, DbExpression, DbExpression, DbExpression, DbExpression, DbExpression, DbExpression, DbExpression, DbExpression, DbExpression, DbExpression, DbExpression, DbExpression, DbExpression> lambdaFunction)
685DbExpression body = lambdaFunction(variables[0], variables[1], variables[2], variables[3], variables[4], variables[5], variables[6], variables[7], variables[8], variables[9], variables[10], variables[11], variables[12], variables[13], variables[14], variables[15]);
System\Data\Common\CommandTrees\DefaultExpressionVisitor.cs (127)
23public class DefaultExpressionVisitor : DbExpressionVisitor<DbExpression>
31protected virtual void OnExpressionReplaced(DbExpression oldExpression, DbExpression newExpression)
47protected virtual DbExpression VisitExpression(DbExpression expression)
49DbExpression newValue = null;
52newValue = expression.Accept<DbExpression>(this);
58protected virtual IList<DbExpression> VisitExpressionList(IList<DbExpression> list)
68DbExpression newInput = this.VisitExpression(binding.Expression);
88DbExpression newInput = this.VisitExpression(binding.Expression);
104DbExpression newExpression = this.VisitExpression(clause.Expression);
144IList<DbExpression> newArguments = this.VisitExpressionList(aggregate.Arguments);
169IList<DbExpression> newArguments = this.VisitExpressionList(aggregate.Arguments);
199DbExpression newBody = this.VisitExpression(lambda.Body);
218private void NotifyIfChanged(DbExpression originalExpression, DbExpression newExpression)
251private DbExpression VisitUnary(DbUnaryExpression expression, Func<DbExpression, DbExpression> callback)
253DbExpression result = expression;
254DbExpression newArgument = this.VisitExpression(expression.Argument);
263private DbExpression VisitTypeUnary(DbUnaryExpression expression, TypeUsage type, Func<DbExpression, TypeUsage, DbExpression> callback)
265DbExpression result = expression;
267DbExpression newArgument = this.VisitExpression(expression.Argument);
279private DbExpression VisitBinary(DbBinaryExpression expression, Func<DbExpression, DbExpression, DbExpression> callback)
281DbExpression result = expression;
283DbExpression newLeft = this.VisitExpression(expression.Left);
284DbExpression newRight = this.VisitExpression(expression.Right);
299DbExpression newTargetRef = this.VisitExpression(entityRef.TargetEntityReference);
323private DbExpression VisitTerminal(DbExpression expression, Func<TypeUsage, DbExpression> reconstructor)
325DbExpression result = expression;
377public override DbExpression Visit(DbExpression expression)
384public override DbExpression Visit(DbConstantExpression expression)
393public override DbExpression Visit(DbNullExpression expression)
400public override DbExpression Visit(DbVariableReferenceExpression expression)
404DbExpression result = expression;
414public override DbExpression Visit(DbParameterReferenceExpression expression)
421public override DbExpression Visit(DbFunctionExpression expression)
425DbExpression result = expression;
426IList<DbExpression> newArguments = this.VisitExpressionList(expression.Arguments);
438public override DbExpression Visit(DbLambdaExpression expression)
442DbExpression result = expression;
443IList<DbExpression> newArguments = this.VisitExpressionList(expression.Arguments);
455public override DbExpression Visit(DbPropertyExpression expression)
459DbExpression result = expression;
460DbExpression newInstance = this.VisitExpression(expression.Instance);
469public override DbExpression Visit(DbComparisonExpression expression)
498public override DbExpression Visit(DbLikeExpression expression)
502DbExpression result = expression;
504DbExpression newArgument = this.VisitExpression(expression.Argument);
505DbExpression newPattern = this.VisitExpression(expression.Pattern);
506DbExpression newEscape = this.VisitExpression(expression.Escape);
518public override DbExpression Visit(DbLimitExpression expression)
522DbExpression result = expression;
524DbExpression newArgument = this.VisitExpression(expression.Argument);
525DbExpression newLimit = this.VisitExpression(expression.Limit);
537public override DbExpression Visit(DbIsNullExpression expression)
556public override DbExpression Visit(DbArithmeticExpression expression)
560DbExpression result = expression;
561IList<DbExpression> newArguments = this.VisitExpressionList(expression.Arguments);
598public override DbExpression Visit(DbAndExpression expression)
605public override DbExpression Visit(DbOrExpression expression)
612public override DbExpression Visit(DbNotExpression expression)
619public override DbExpression Visit(DbDistinctExpression expression)
626public override DbExpression Visit(DbElementExpression expression)
630Func<DbExpression, DbExpression> resultConstructor;
644public override DbExpression Visit(DbIsEmptyExpression expression)
651public override DbExpression Visit(DbUnionAllExpression expression)
658public override DbExpression Visit(DbIntersectExpression expression)
665public override DbExpression Visit(DbExceptExpression expression)
672public override DbExpression Visit(DbTreatExpression expression)
679public override DbExpression Visit(DbIsOfExpression expression)
693public override DbExpression Visit(DbCastExpression expression)
700public override DbExpression Visit(DbCaseExpression expression)
704DbExpression result = expression;
706IList<DbExpression> newWhens = this.VisitExpressionList(expression.When);
707IList<DbExpression> newThens = this.VisitExpressionList(expression.Then);
708DbExpression newElse = this.VisitExpression(expression.Else);
720public override DbExpression Visit(DbOfTypeExpression expression)
734public override DbExpression Visit(DbNewInstanceExpression expression)
738DbExpression result = expression;
740IList<DbExpression> newArguments = this.VisitExpressionList(expression.Arguments);
762public override DbExpression Visit(DbRefExpression expression)
766DbExpression result = expression;
770DbExpression newArgument = this.VisitExpression(expression.Argument);
783public override DbExpression Visit(DbRelationshipNavigationExpression expression)
787DbExpression result = expression;
792DbExpression newNavSource = this.VisitExpression(expression.NavigationSource);
804public override DbExpression Visit(DbDerefExpression expression)
811public override DbExpression Visit(DbRefKeyExpression expression)
818public override DbExpression Visit(DbEntityRefExpression expression)
825public override DbExpression Visit(DbScanExpression expression)
829DbExpression result = expression;
840public override DbExpression Visit(DbFilterExpression expression)
844DbExpression result = expression;
847DbExpression predicate = this.VisitExpression(expression.Predicate);
858public override DbExpression Visit(DbProjectExpression expression)
862DbExpression result = expression;
865DbExpression projection = this.VisitExpression(expression.Projection);
876public override DbExpression Visit(DbCrossJoinExpression expression)
880DbExpression result = expression;
891public override DbExpression Visit(DbJoinExpression expression)
895DbExpression result = expression;
901DbExpression newCondition = this.VisitExpression(expression.JoinCondition);
926public override DbExpression Visit(DbApplyExpression expression)
930DbExpression result = expression;
953public override DbExpression Visit(DbGroupByExpression expression)
957DbExpression result = expression;
961IList<DbExpression> newKeys = this.VisitExpressionList(expression.Keys);
983public override DbExpression Visit(DbSkipExpression expression)
987DbExpression result = expression;
992DbExpression newCount = this.VisitExpression(expression.Count);
1004public override DbExpression Visit(DbSortExpression expression)
1008DbExpression result = expression;
1023public override DbExpression Visit(DbQuantifierExpression expression)
1027DbExpression result = expression;
1030DbExpression predicate = this.VisitExpression(expression.Predicate);
System\Data\Common\CommandTrees\ExpressionBuilder\DbExpressionBuilder.cs (294)
27/// Provides an API to construct <see cref="DbExpression"/>s and allows that API to be accessed as extension methods on the expression type itself.
61public static KeyValuePair<string, DbExpression> As(this DbExpression value, string alias)
63return new KeyValuePair<string, DbExpression>(alias, value);
82public static DbExpressionBinding Bind(this DbExpression input)
95public static DbExpressionBinding BindAs(this DbExpression input, string varName)
109public static DbGroupExpressionBinding GroupBind(this DbExpression input)
124public static DbGroupExpressionBinding GroupBindAs(this DbExpression input, string varName, string groupVarName)
148public static DbFunctionAggregate Aggregate(this EdmFunction function, DbExpression argument)
165public static DbFunctionAggregate AggregateDistinct(this EdmFunction function, DbExpression argument)
170private static DbFunctionAggregate CreateFunctionAggregate(EdmFunction function, DbExpression argument, bool isDistinct)
184/*ENABLE_ELEMENT_SELECTOR(*/internal/*)*/ static DbGroupAggregate GroupAggregate(DbExpression argument)
206public static DbLambda Lambda(DbExpression body, IEnumerable<DbVariableReferenceExpression> variables)
226public static DbLambda Lambda(DbExpression body, params DbVariableReferenceExpression[] variables)
231private static DbLambda CreateLambda(DbExpression body, IEnumerable<DbVariableReferenceExpression> variables)
244public static DbSortClause ToSortClause(this DbExpression key)
257public static DbSortClause ToSortClauseDescending(this DbExpression key)
272public static DbSortClause ToSortClause(this DbExpression key, string collation)
287public static DbSortClause ToSortClauseDescending(this DbExpression key, string collation)
307public static DbQuantifierExpression All(this DbExpressionBinding input, DbExpression predicate)
323public static DbQuantifierExpression Any(this DbExpressionBinding input, DbExpression predicate)
390public static DbJoinExpression InnerJoin(this DbExpressionBinding left, DbExpressionBinding right, DbExpression joinCondition)
413public static DbJoinExpression LeftOuterJoin(this DbExpressionBinding left, DbExpressionBinding right, DbExpression joinCondition)
436public static DbJoinExpression FullOuterJoin(this DbExpressionBinding left, DbExpressionBinding right, DbExpression joinCondition)
452public static DbFilterExpression Filter(this DbExpressionBinding input, DbExpression predicate)
477public static DbGroupByExpression GroupBy(this DbGroupExpressionBinding input, IEnumerable<KeyValuePair<string, DbExpression>> keys, IEnumerable<KeyValuePair<string, DbAggregate>> aggregates)
492public static DbProjectExpression Project(this DbExpressionBinding input, DbExpression projection)
514public static DbSkipExpression Skip(this DbExpressionBinding input, IEnumerable<DbSortClause> sortOrder, DbExpression count)
687public static DbAndExpression And(this DbExpression left, DbExpression right)
703public static DbOrExpression Or(this DbExpression left, DbExpression right)
718public static DbNotExpression Not(this DbExpression argument)
728private static DbArithmeticExpression CreateArithmetic(DbExpressionKind kind, DbExpression left, DbExpression right)
745public static DbArithmeticExpression Divide(this DbExpression left, DbExpression right)
760public static DbArithmeticExpression Minus(this DbExpression left, DbExpression right)
775public static DbArithmeticExpression Modulo(this DbExpression left, DbExpression right)
790public static DbArithmeticExpression Multiply(this DbExpression left, DbExpression right)
805public static DbArithmeticExpression Plus(this DbExpression left, DbExpression right)
819public static DbArithmeticExpression UnaryMinus(this DbExpression argument)
835public static DbArithmeticExpression Negate(this DbExpression argument)
844private static DbComparisonExpression CreateComparison(DbExpressionKind kind, DbExpression left, DbExpression right)
860public static DbComparisonExpression Equal(this DbExpression left, DbExpression right)
875public static DbComparisonExpression NotEqual(this DbExpression left, DbExpression right)
890public static DbComparisonExpression GreaterThan(this DbExpression left, DbExpression right)
905public static DbComparisonExpression LessThan(this DbExpression left, DbExpression right)
920public static DbComparisonExpression GreaterThanOrEqual(this DbExpression left, DbExpression right)
935public static DbComparisonExpression LessThanOrEqual(this DbExpression left, DbExpression right)
947public static DbIsNullExpression IsNull(this DbExpression argument)
961public static DbLikeExpression Like(this DbExpression argument, DbExpression pattern)
964DbExpression escape = DbExpressionBuilder.Null(pattern.ResultType);
977public static DbLikeExpression Like(this DbExpression argument, DbExpression pattern, DbExpression escape)
995public static DbCastExpression CastTo(this DbExpression argument, TypeUsage toType)
1014public static DbTreatExpression TreatAs(this DbExpression argument, TypeUsage treatType)
1023/// <param name="argument">A <see cref="DbExpression"/> that specifies the input set.</param>
1036public static DbOfTypeExpression OfType(this DbExpression argument, TypeUsage type)
1045/// <param name="argument">An <see cref="DbExpression"/> that specifies the input set.</param>
1058public static DbOfTypeExpression OfTypeOnly(this DbExpression argument, TypeUsage type)
1078public static DbIsOfExpression IsOf(this DbExpression argument, TypeUsage type)
1098public static DbIsOfExpression IsOfOnly(this DbExpression argument, TypeUsage type)
1111/// <param name="argument">An <see cref="DbExpression"/> that provides the reference. This expression must have a reference Type</param>
1116public static DbDerefExpression Deref(this DbExpression argument)
1129public static DbEntityRefExpression GetEntityRef(this DbExpression argument)
1139/// <param name="keyValues">A collection of <see cref="DbExpression"/>s that provide the key values. These expressions must match (in number, type, and order) the key properties of the referenced entity type.</param>
1146public static DbRefExpression CreateRef(this EntitySet entitySet, IEnumerable<DbExpression> keyValues)
1155/// <param name="keyValues">A collection of <see cref="DbExpression"/>s that provide the key values. These expressions must match (in number, type, and order) the key properties of the referenced entity type.</param>
1162public static DbRefExpression CreateRef(this EntitySet entitySet, params DbExpression[] keyValues)
1172/// <param name="keyValues">A collection of <see cref="DbExpression"/>s that provide the key values. These expressions must match (in number, type, and order) the key properties of the referenced entity type.</param>
1180public static DbRefExpression CreateRef(this EntitySet entitySet, EntityType entityType, IEnumerable<DbExpression> keyValues)
1190/// <param name="keyValues">A collection of <see cref="DbExpression"/>s that provide the key values. These expressions must match (in number, type, and order) the key properties of the referenced entity type.</param>
1198public static DbRefExpression CreateRef(this EntitySet entitySet, EntityType entityType, params DbExpression[] keyValues)
1203private static DbRefExpression CreateRefExpression(EntitySet entitySet, IEnumerable<DbExpression> keyValues)
1205DbExpression keyConstructor;
1210private static DbRefExpression CreateRefExpression(EntitySet entitySet, EntityType entityType, IEnumerable<DbExpression> keyValues)
1212DbExpression keyConstructor;
1221/// <param name="keyRow">A <see cref="DbExpression"/> that constructs a record with columns that match (in number, type, and order) the Key properties of the referenced Entity type.</param>
1231public static DbRefExpression RefFromKey(this EntitySet entitySet, DbExpression keyRow)
1241/// <param name="keyRow">A <see cref="DbExpression"/> that constructs a record with columns that match (in number, type, and order) the Key properties of the referenced Entity type.</param>
1253public static DbRefExpression RefFromKey(this EntitySet entitySet, DbExpression keyRow, EntityType entityType)
1266public static DbRefKeyExpression GetRefKey(this DbExpression argument)
1287public static DbRelationshipNavigationExpression Navigate(this DbExpression navigateFrom, RelationshipEndMember fromEnd, RelationshipEndMember toEnd)
1314public static DbRelationshipNavigationExpression Navigate(this RelationshipType type, string fromEndName, string toEndName, DbExpression navigateFrom)
1333public static DbDistinctExpression Distinct(this DbExpression argument)
1346public static DbElementExpression Element(this DbExpression argument)
1359public static DbIsEmptyExpression IsEmpty(this DbExpression argument)
1373public static DbExceptExpression Except(this DbExpression left, DbExpression right)
1387public static DbIntersectExpression Intersect(this DbExpression left, DbExpression right)
1401public static DbUnionAllExpression UnionAll(this DbExpression left, DbExpression right)
1419public static DbLimitExpression Limit(this DbExpression argument, DbExpression count)
1444public static DbCaseExpression Case(IEnumerable<DbExpression> whenExpressions, IEnumerable<DbExpression> thenExpressions, DbExpression elseExpression)
1466public static DbFunctionExpression Invoke(this EdmFunction function, IEnumerable<DbExpression> arguments)
1485public static DbFunctionExpression Invoke(this EdmFunction function, params DbExpression[] arguments)
1490private static DbFunctionExpression InvokeFunction(EdmFunction function, IEnumerable<DbExpression> arguments)
1511public static DbLambdaExpression Invoke(this DbLambda lambda, IEnumerable<DbExpression> arguments)
1530public static DbLambdaExpression Invoke(this DbLambda lambda, params DbExpression[] arguments)
1535private static DbLambdaExpression InvokeLambda(DbLambda lambda, IEnumerable<DbExpression> arguments)
1565public static DbNewInstanceExpression New(this TypeUsage instanceType, IEnumerable<DbExpression> arguments)
1593public static DbNewInstanceExpression New(this TypeUsage instanceType, params DbExpression[] arguments)
1598private static DbNewInstanceExpression NewInstance(TypeUsage instanceType, IEnumerable<DbExpression> arguments)
1614public static DbNewInstanceExpression NewCollection(IEnumerable<DbExpression> elements)
1628public static DbNewInstanceExpression NewCollection(params DbExpression[] elements)
1633private static DbNewInstanceExpression CreateNewCollection(IEnumerable<DbExpression> elements)
1664public static DbNewInstanceExpression NewRow(IEnumerable<KeyValuePair<string, DbExpression>> columnValues)
1679public static DbPropertyExpression Property(this DbExpression instance, EdmProperty propertyMetadata)
1692public static DbPropertyExpression Property(this DbExpression instance, NavigationProperty navigationProperty)
1705public static DbPropertyExpression Property(this DbExpression instance, RelationshipEndMember relationshipEnd)
1718public static DbPropertyExpression Property(this DbExpression instance, string propertyName)
1723private static DbPropertyExpression PropertyFromMember(DbExpression instance, EdmMember property, string propertyArgumentName)
1729private static DbPropertyExpression PropertyByName(DbExpression instance, string propertyName, bool ignoreCase)
1776private static DbExpressionBinding ConvertToBinding<TResult>(DbExpression source, Func<DbExpression, TResult> argument, string argumentName, out TResult argumentResult)
1781private static DbExpressionBinding ConvertToBinding<TResult>(DbExpression source, string sourceName, Func<DbExpression, TResult> argument, string argumentName, out TResult argumentResult)
1791private static DbExpressionBinding[] ConvertToBinding(DbExpression left, string leftArgumentName, DbExpression right, string rightArgumentName, Func<DbExpression, DbExpression, DbExpression> argument, string argumentName, out DbExpression argumentExp)
1842private static bool TryResolveToConstant(Type type, object value, out DbExpression constantOrNullExpression)
1869private static DbExpression ResolveToExpression<TArgument>(TArgument argument)
1873DbExpression constantResult;
1881return (DbExpression)null;
1885if (typeof(DbExpression).IsAssignableFrom(typeof(TArgument)))
1887return (DbExpression)untypedArgument;
1897List<KeyValuePair<string, DbExpression>> columnValues;
1898if (TryGetAnonymousTypeValues<TArgument, DbExpression>(untypedArgument, out columnValues))
1907private static DbApplyExpression CreateApply(DbExpression source, Func<DbExpression, KeyValuePair<string, DbExpression>> apply, Func<DbExpressionBinding, DbExpressionBinding, DbApplyExpression> resultBuilder)
1909KeyValuePair<string, DbExpression> applyTemplate;
1933public static DbQuantifierExpression All(this DbExpression source, Func<DbExpression, DbExpression> predicate)
1935DbExpression predicateExp;
1941/// Creates a new <see cref="DbExpression"/> that determines whether the specified set argument is non-empty.
1947public static DbExpression Any(this DbExpression source)
1953/// Creates a new <see cref="DbExpression"/> that determines whether the specified set argument is non-empty.
1959public static DbExpression Exists(this DbExpression argument)
1982public static DbQuantifierExpression Any(this DbExpression source, Func<DbExpression, DbExpression> predicate)
1984DbExpression predicateExp;
1994/// A <see cref="DbExpression"/> that specifies the input set.
2004public static DbApplyExpression CrossApply(this DbExpression source, Func<DbExpression, KeyValuePair<string, DbExpression>> apply)
2017/// A <see cref="DbExpression"/> that specifies the input set.
2027public static DbApplyExpression OuterApply(this DbExpression source, Func<DbExpression, KeyValuePair<string, DbExpression>> apply)
2041/// <param name="left">A <see cref="DbExpression"/> that specifies the left set argument.</param>
2042/// <param name="right">A <see cref="DbExpression"/> that specifies the right set argument.</param>
2064public static DbJoinExpression FullOuterJoin(this DbExpression left, DbExpression right, Func<DbExpression, DbExpression, DbExpression> joinCondition)
2066DbExpression condExp;
2075/// <param name="left">A <see cref="DbExpression"/> that specifies the left set argument.</param>
2076/// <param name="right">A <see cref="DbExpression"/> that specifies the right set argument.</param>
2098public static DbJoinExpression InnerJoin(this DbExpression left, DbExpression right, Func<DbExpression, DbExpression, DbExpression> joinCondition)
2100DbExpression condExp;
2109/// <param name="left">A <see cref="DbExpression"/> that specifies the left set argument.</param>
2110/// <param name="right">A <see cref="DbExpression"/> that specifies the right set argument.</param>
2132public static DbJoinExpression LeftOuterJoin(this DbExpression left, DbExpression right, Func<DbExpression, DbExpression, DbExpression> joinCondition)
2134DbExpression condExp;
2143/// <param name="outer">A <see cref="DbExpression"/> that specifies the outer set argument.</param>
2144/// <param name="inner">A <see cref="DbExpression"/> that specifies the inner set argument.</param>
2163public static DbJoinExpression Join(this DbExpression outer, DbExpression inner, Func<DbExpression, DbExpression> outerKey, Func<DbExpression, DbExpression> innerKey)
2165DbExpression leftOperand;
2168DbExpression rightOperand;
2171DbExpression joinCondition = DbExpressionBuilder.Equal(leftOperand, rightOperand);
2180/// <param name="outer">A <see cref="DbExpression"/> that specifies the outer set argument.</param>
2181/// <param name="inner">A <see cref="DbExpression"/> that specifies the inner set argument.</param>
2187/// into a <see cref="DbExpression"/>.
2214/// To be compatible with Join, <typeparamref name="TSelector"/> must be derived from <see cref="DbExpression"/>,
2222public static DbProjectExpression Join<TSelector>(this DbExpression outer, DbExpression inner, Func<DbExpression, DbExpression> outerKey, Func<DbExpression, DbExpression> innerKey, Func<DbExpression, DbExpression, TSelector> selector)
2232DbExpression left = DbExpressionBuilder.Property(joinBinding.Variable, joinExpression.Left.VariableName);
2233DbExpression right = DbExpressionBuilder.Property(joinBinding.Variable, joinExpression.Right.VariableName);
2235DbExpression projection = DbExpressionBuilder.ResolveToExpression(intermediateSelector);
2258public static DbSortExpression OrderBy(this DbExpression source, Func<DbExpression, DbExpression> sortKey)
2260DbExpression keyExpression;
2285public static DbSortExpression OrderBy(this DbExpression source, Func<DbExpression, DbExpression> sortKey, string collation)
2287DbExpression keyExpression;
2310public static DbSortExpression OrderByDescending(this DbExpression source, Func<DbExpression, DbExpression> sortKey)
2312DbExpression keyExpression;
2337public static DbSortExpression OrderByDescending(this DbExpression source, Func<DbExpression, DbExpression> sortKey, string collation)
2339DbExpression keyExpression;
2352/// into a <see cref="DbExpression"/>.
2360/// To be compatible with Select, <typeparamref name="TProjection"/> must be derived from <see cref="DbExpression"/>,
2368public static DbProjectExpression Select<TProjection>(this DbExpression source, Func<DbExpression, TProjection> projection)
2373DbExpression projectionExp = ResolveToExpression(intermediateProjection);
2383/// A <see cref="DbExpression"/> that specifies the input set.
2393public static DbProjectExpression SelectMany(this DbExpression source, Func<DbExpression, DbExpression> apply)
2395DbExpression functorResult;
2412/// A <see cref="DbExpression"/> that specifies the input set.
2419/// This method must produce an instance of a type that is compatible with SelectMany and can be resolved into a <see cref="DbExpression"/>.
2429/// To be compatible with SelectMany, <typeparamref name="TSelector"/> must be derived from <see cref="DbExpression"/>,
2437public static DbProjectExpression SelectMany<TSelector>(this DbExpression source, Func<DbExpression, DbExpression> apply, Func<DbExpression, DbExpression, TSelector> selector)
2439DbExpression functorResult;
2447DbExpression left = DbExpressionBuilder.Property(projectionBinding.Variable, inputBinding.VariableName);
2448DbExpression right = DbExpressionBuilder.Property(projectionBinding.Variable, functorBinding.VariableName);
2450DbExpression projection = ResolveToExpression(selectorResult);
2467public static DbSkipExpression Skip(this DbSortExpression argument, DbExpression count)
2485public static DbLimitExpression Take(this DbExpression argument, DbExpression count)
2490private static DbSortExpression CreateThenBy(DbSortExpression source, Func<DbExpression, DbExpression> sortKey, bool ascending, string collation, bool useCollation)
2494DbExpression sortKeyResult = sortKey(source.Input.Variable);
2531public static DbSortExpression ThenBy(this DbSortExpression source, Func<DbExpression, DbExpression> sortKey)
2557public static DbSortExpression ThenBy(this DbSortExpression source, Func<DbExpression, DbExpression> sortKey, string collation)
2581public static DbSortExpression ThenByDescending(this DbSortExpression source, Func<DbExpression, DbExpression> sortKey)
2607public static DbSortExpression ThenByDescending(this DbSortExpression source, Func<DbExpression, DbExpression> sortKey, string collation)
2629public static DbFilterExpression Where(this DbExpression source, Func<DbExpression, DbExpression> predicate)
2631DbExpression predicateExp;
2637/// Creates a new <see cref="DbExpression"/> that computes the union of the left and right set arguments with duplicates removed.
2644public static DbExpression Union(this DbExpression left, DbExpression right)
2719internal static DbExpression CreateJoinExpressionByKind(DbExpressionKind joinKind, DbExpression joinCondition, DbExpressionBinding input1, DbExpressionBinding input2)
2756internal static DbIsNullExpression CreateIsNullExpressionAllowingRowTypeArgument(DbExpression argument)
2778internal static DbElementExpression CreateElementExpressionUnwrapSingleProperty(DbExpression argument)
2807internal static DbRelatedEntityRef CreateRelatedEntityRef(RelationshipEndMember sourceEnd, RelationshipEndMember targetEnd, DbExpression targetEntity)
2824internal static DbNewInstanceExpression CreateNewEntityWithRelationshipsExpression(EntityType entityType, IList<DbExpression> attributeValues, IList<DbRelatedEntityRef> relationships)
2833/// Same as <see cref="Navigate(DbExpression, RelationshipEndMember, RelationshipEndMember)"/> only allows the property type of <paramref name="fromEnd"/>
2841internal static DbRelationshipNavigationExpression NavigateAllowingAllRelationshipsInSameTypeHierarchy(this DbExpression navigateFrom, RelationshipEndMember fromEnd, RelationshipEndMember toEnd)
2848internal static DbPropertyExpression CreatePropertyExpressionFromMember(DbExpression instance, EdmMember member)
System\Data\Common\CommandTrees\ExpressionBuilder\EdmFunctions.cs (119)
19/// Provides an API to construct <see cref="DbExpression"/>s that invoke canonical EDM functions, and allows that API to be accessed as extension methods on the expression type itself.
55internal static DbFunctionExpression InvokeCanonicalFunction(string functionName, params DbExpression[] arguments)
80public static DbFunctionExpression Average(this DbExpression collection)
94public static DbFunctionExpression Count(this DbExpression collection)
108public static DbFunctionExpression LongCount(this DbExpression collection)
122public static DbFunctionExpression Max(this DbExpression collection)
136public static DbFunctionExpression Min(this DbExpression collection)
150public static DbFunctionExpression Sum(this DbExpression collection)
165public static DbFunctionExpression StDev(this DbExpression collection)
180public static DbFunctionExpression StDevP(this DbExpression collection)
194public static DbFunctionExpression Var(this DbExpression collection)
208public static DbFunctionExpression VarP(this DbExpression collection)
228public static DbFunctionExpression Concat(this DbExpression string1, DbExpression string2)
247public static DbExpression Contains(this DbExpression searchedString, DbExpression searchedForString)
264public static DbFunctionExpression EndsWith(this DbExpression stringArgument, DbExpression suffix)
282public static DbFunctionExpression IndexOf(this DbExpression searchString, DbExpression stringToFind)
299public static DbFunctionExpression Left(this DbExpression stringArgument, DbExpression length)
315public static DbFunctionExpression Length(this DbExpression stringArgument)
332public static DbFunctionExpression Replace(this DbExpression stringArgument, DbExpression toReplace, DbExpression replacement)
349public static DbFunctionExpression Reverse(this DbExpression stringArgument)
365public static DbFunctionExpression Right(this DbExpression stringArgument, DbExpression length)
382public static DbFunctionExpression StartsWith(this DbExpression stringArgument, DbExpression prefix)
403public static DbFunctionExpression Substring(this DbExpression stringArgument, DbExpression start, DbExpression length)
420public static DbFunctionExpression ToLower(this DbExpression stringArgument)
435public static DbFunctionExpression ToUpper(this DbExpression stringArgument)
450public static DbFunctionExpression Trim(this DbExpression stringArgument)
465public static DbFunctionExpression TrimEnd(this DbExpression stringArgument)
480public static DbFunctionExpression TrimStart(this DbExpression stringArgument)
499public static DbFunctionExpression Year(this DbExpression dateValue)
514public static DbFunctionExpression Month(this DbExpression dateValue)
529public static DbFunctionExpression Day(this DbExpression dateValue)
544public static DbFunctionExpression DayOfYear(this DbExpression dateValue)
559public static DbFunctionExpression Hour(this DbExpression timeValue)
574public static DbFunctionExpression Minute(this DbExpression timeValue)
589public static DbFunctionExpression Second(this DbExpression timeValue)
604public static DbFunctionExpression Millisecond(this DbExpression timeValue)
618public static DbFunctionExpression GetTotalOffsetMinutes(this DbExpression dateTimeOffsetArgument)
664public static DbFunctionExpression TruncateTime(this DbExpression dateValue)
684public static DbFunctionExpression CreateDateTime(DbExpression year, DbExpression month, DbExpression day, DbExpression hour, DbExpression minute, DbExpression second)
710public static DbFunctionExpression CreateDateTimeOffset(DbExpression year, DbExpression month, DbExpression day, DbExpression hour, DbExpression minute, DbExpression second, DbExpression timeZoneOffset)
733public static DbFunctionExpression CreateTime(DbExpression hour, DbExpression minute, DbExpression second)
755public static DbFunctionExpression AddYears(this DbExpression dateValue, DbExpression addValue)
772public static DbFunctionExpression AddMonths(this DbExpression dateValue, DbExpression addValue)
789public static DbFunctionExpression AddDays(this DbExpression dateValue, DbExpression addValue)
806public static DbFunctionExpression AddHours(this DbExpression timeValue, DbExpression addValue)
823public static DbFunctionExpression AddMinutes(this DbExpression timeValue, DbExpression addValue)
840public static DbFunctionExpression AddSeconds(this DbExpression timeValue, DbExpression addValue)
857public static DbFunctionExpression AddMilliseconds(this DbExpression timeValue, DbExpression addValue)
874public static DbFunctionExpression AddMicroseconds(this DbExpression timeValue, DbExpression addValue)
891public static DbFunctionExpression AddNanoseconds(this DbExpression timeValue, DbExpression addValue)
913public static DbFunctionExpression DiffYears(this DbExpression dateValue1, DbExpression dateValue2)
931public static DbFunctionExpression DiffMonths(this DbExpression dateValue1, DbExpression dateValue2)
949public static DbFunctionExpression DiffDays(this DbExpression dateValue1, DbExpression dateValue2)
967public static DbFunctionExpression DiffHours(this DbExpression timeValue1, DbExpression timeValue2)
985public static DbFunctionExpression DiffMinutes(this DbExpression timeValue1, DbExpression timeValue2)
1003public static DbFunctionExpression DiffSeconds(this DbExpression timeValue1, DbExpression timeValue2)
1021public static DbFunctionExpression DiffMilliseconds(this DbExpression timeValue1, DbExpression timeValue2)
1039public static DbFunctionExpression DiffMicroseconds(this DbExpression timeValue1, DbExpression timeValue2)
1057public static DbFunctionExpression DiffNanoseconds(this DbExpression timeValue1, DbExpression timeValue2)
1077public static DbFunctionExpression Round(this DbExpression value)
1093public static DbFunctionExpression Round(this DbExpression value, DbExpression digits)
1109public static DbFunctionExpression Floor(this DbExpression value)
1124public static DbFunctionExpression Ceiling(this DbExpression value)
1139public static DbFunctionExpression Abs(this DbExpression value)
1155public static DbFunctionExpression Truncate(this DbExpression value, DbExpression digits)
1172public static DbFunctionExpression Power(this DbExpression baseArgument, DbExpression exponent)
1193public static DbFunctionExpression BitwiseAnd(this DbExpression value1, DbExpression value2)
1210public static DbFunctionExpression BitwiseOr(this DbExpression value1, DbExpression value2)
1226public static DbFunctionExpression BitwiseNot(this DbExpression value)
1242public static DbFunctionExpression BitwiseXor(this DbExpression value1, DbExpression value2)
System\Data\Common\CommandTrees\ExpressionBuilder\Internal\ArgumentValidation.cs (91)
42private static void RequireCompatibleType(DbExpression expression, TypeUsage requiredResultType, string argumentName)
47private static void RequireCompatibleType(DbExpression expression, TypeUsage requiredResultType, string argumentName, int argumentIndex)
69private static void RequireCompatibleType(DbExpression expression, PrimitiveTypeKind requiredResultType, string argumentName)
74private static void RequireCompatibleType(DbExpression expression, PrimitiveTypeKind requiredResultType, string argumentName, int index)
100private static void RequireCompatibleType(DbExpression from, RelationshipEndMember end, bool allowAllRelationshipsInSameTypeHierarchy)
130private static void RequireCollectionArgument<TExpressionType>(DbExpression argument)
140private static TypeUsage RequireCollectionArguments<TExpressionType>(DbExpression left, DbExpression right)
158private static TypeUsage RequireComparableCollectionArguments<TExpressionType>(DbExpression left, DbExpression right)
183private static DbExpressionList CreateExpressionList(IEnumerable<DbExpression> arguments, string argumentName, Action<DbExpression, int> validationCallback)
188private static DbExpressionList CreateExpressionList(IEnumerable<DbExpression> arguments, string argumentName, bool allowEmpty, Action<DbExpression, int> validationCallback)
207private static DbExpressionList CreateExpressionList(IEnumerable<DbExpression> arguments, string argumentName, int expectedElementCount, Action<DbExpression, int> validationCallback)
227private static TypeUsage ValidateBinary(DbExpression left, DbExpression right)
235private static void ValidateUnary(DbExpression argument)
240private static void ValidateTypeUnary(DbExpression argument, TypeUsage type, string typeArgumentName)
248internal static TypeUsage ValidateBindAs(DbExpression input, string varName)
278internal static TypeUsage ValidateGroupBindAs(DbExpression input, string varName, string groupVarName)
324internal static DbExpressionList ValidateFunctionAggregate(EdmFunction function, IEnumerable<DbExpression> args)
355internal static DbExpressionList ValidateGroupAggregate(DbExpression argument)
361internal static void ValidateSortClause(DbExpression key)
371internal static void ValidateSortClause(DbExpression key, string collation)
391internal static System.Collections.ObjectModel.ReadOnlyCollection<DbVariableReferenceExpression> ValidateLambda(IEnumerable<DbVariableReferenceExpression> variables, DbExpression body)
427private static void ValidateBound(DbExpressionBinding input, DbExpression argument, string argumentName)
433internal static TypeUsage ValidateQuantifier(DbExpressionBinding input, DbExpression predicate)
522internal static TypeUsage ValidateJoin(DbExpressionBinding left, DbExpressionBinding right, DbExpression joinCondition)
554internal static TypeUsage ValidateFilter(DbExpressionBinding input, DbExpression predicate)
561internal static TypeUsage ValidateGroupBy(DbGroupExpressionBinding input, IEnumerable<KeyValuePair<string, DbExpression>> keys, IEnumerable<KeyValuePair<string, DbAggregate>> aggregates, out DbExpressionList validKeys, out System.Collections.ObjectModel.ReadOnlyCollection<DbAggregate> validAggregates)
653internal static TypeUsage ValidateProject(DbExpressionBinding input, DbExpression projection)
676internal static System.Collections.ObjectModel.ReadOnlyCollection<DbSortClause> ValidateSkip(DbExpressionBinding input, IEnumerable<DbSortClause> sortOrder, DbExpression count)
830internal static TypeUsage ValidateAnd(DbExpression left, DbExpression right)
841internal static TypeUsage ValidateOr(DbExpression left, DbExpression right)
852internal static TypeUsage ValidateNot(DbExpression argument)
871internal static DbExpressionList ValidateArithmetic(DbExpression argument, out TypeUsage resultType)
896internal static DbExpressionList ValidateArithmetic(DbExpression left, DbExpression right, out TypeUsage resultType)
911internal static TypeUsage ValidateComparison(DbExpressionKind kind, DbExpression left, DbExpression right)
945internal static TypeUsage ValidateIsNull(DbExpression argument)
950internal static TypeUsage ValidateIsNull(DbExpression argument, bool allowRowType)
977internal static TypeUsage ValidateLike(DbExpression argument, DbExpression pattern)
988internal static TypeUsage ValidateLike(DbExpression argument, DbExpression pattern, DbExpression escape)
1002internal static void ValidateCastTo(DbExpression argument, TypeUsage toType)
1015internal static void ValidateTreatAs(DbExpression argument, TypeUsage asType)
1033internal static TypeUsage ValidateOfType(DbExpression argument, TypeUsage type)
1064internal static TypeUsage ValidateIsOf(DbExpression argument, TypeUsage type)
1089internal static TypeUsage ValidateDeref(DbExpression argument)
1108internal static TypeUsage ValidateGetEntityRef(DbExpression argument)
1121internal static TypeUsage ValidateCreateRef(EntitySet entitySet, IEnumerable<DbExpression> keyValues, out DbExpression keyConstructor)
1127internal static TypeUsage ValidateCreateRef(EntitySet entitySet, EntityType entityType, IEnumerable<DbExpression> keyValues, out DbExpression keyConstructor)
1149return new KeyValuePair<string, DbExpression>(keyMembers[idx].Name, valueExp);
1160internal static TypeUsage ValidateRefFromKey(EntitySet entitySet, DbExpression keyValues)
1166internal static TypeUsage ValidateRefFromKey(EntitySet entitySet, DbExpression keyValues, EntityType entityType)
1198internal static TypeUsage ValidateGetRefKey(DbExpression argument)
1215internal static TypeUsage ValidateNavigate(DbExpression navigateFrom, RelationshipType type, string fromEndName, string toEndName, out RelationshipEndMember fromEnd, out RelationshipEndMember toEnd)
1251internal static TypeUsage ValidateNavigate(DbExpression navigateFrom, RelationshipEndMember fromEnd, RelationshipEndMember toEnd, out RelationshipType relType, bool allowAllRelationshipsInSameTypeHierarchy)
1285internal static TypeUsage ValidateDistinct(DbExpression argument)
1306internal static TypeUsage ValidateElement(DbExpression argument)
1321internal static TypeUsage ValidateIsEmpty(DbExpression argument)
1333internal static TypeUsage ValidateExcept(DbExpression left, DbExpression right)
1345internal static TypeUsage ValidateIntersect(DbExpression left, DbExpression right)
1355internal static TypeUsage ValidateUnionAll(DbExpression left, DbExpression right)
1365internal static TypeUsage ValidateLimit(DbExpression argument, DbExpression limit)
1407internal static TypeUsage ValidateCase(IEnumerable<DbExpression> whenExpressions, IEnumerable<DbExpression> thenExpressions, DbExpression elseExpression, out DbExpressionList validWhens, out DbExpressionList validThens)
1464internal static TypeUsage ValidateFunction(EdmFunction function, IEnumerable<DbExpression> arguments, out DbExpressionList validArgs)
1504internal static TypeUsage ValidateInvoke(DbLambda lambda, IEnumerable<DbExpression> arguments, out DbExpressionList validArguments)
1525internal static TypeUsage ValidateNewCollection(IEnumerable<DbExpression> elements, out DbExpressionList validElements)
1565validElements = new DbExpressionList(new DbExpression[] { });
1569internal static TypeUsage ValidateNewRow(IEnumerable<KeyValuePair<string, DbExpression>> columnValues, out DbExpressionList validElements)
1585internal static TypeUsage ValidateNew(TypeUsage instanceType, IEnumerable<DbExpression> arguments, out DbExpressionList validArguments)
1643internal static TypeUsage ValidateNewEntityWithRelationships(EntityType entityType, IEnumerable<DbExpression> attributeValues, IList<DbRelatedEntityRef> relationships, out DbExpressionList validArguments, out System.Collections.ObjectModel.ReadOnlyCollection<DbRelatedEntityRef> validRelatedRefs)
1681internal static TypeUsage ValidateProperty(DbExpression instance, EdmMember property, string propertyArgumentName)
1704internal static TypeUsage ValidateProperty(DbExpression instance, string propertyName, bool ignoreCase, out EdmMember foundMember)
2054private static bool IsConstantNegativeInteger(DbExpression expression)
System\Data\Common\CommandTrees\ExpressionBuilder\Spatial\SpatialEdmFunctions.cs (142)
20/// Provides an API to construct <see cref="DbExpression"/>s that invoke spatial realted canonical EDM functions, and, where appropriate, allows that API to be accessed as extension methods on the expression type itself.
39public static DbFunctionExpression GeometryFromText(DbExpression wellKnownText)
55public static DbFunctionExpression GeometryFromText(DbExpression wellKnownText, DbExpression coordinateSystemId)
72public static DbFunctionExpression GeometryPointFromText(DbExpression pointWellKnownText, DbExpression coordinateSystemId)
89public static DbFunctionExpression GeometryLineFromText(DbExpression lineWellKnownText, DbExpression coordinateSystemId)
106public static DbFunctionExpression GeometryPolygonFromText(DbExpression polygonWellKnownText, DbExpression coordinateSystemId)
127public static DbFunctionExpression GeometryMultiPointFromText(DbExpression multiPointWellKnownText, DbExpression coordinateSystemId)
148public static DbFunctionExpression GeometryMultiLineFromText(DbExpression multiLineWellKnownText, DbExpression coordinateSystemId)
167public static DbFunctionExpression GeometryMultiPolygonFromText(DbExpression multiPolygonWellKnownText, DbExpression coordinateSystemId)
184public static DbFunctionExpression GeometryCollectionFromText(DbExpression geometryCollectionWellKnownText, DbExpression coordinateSystemId)
205public static DbFunctionExpression GeometryFromBinary(DbExpression wellKnownBinaryValue)
221public static DbFunctionExpression GeometryFromBinary(DbExpression wellKnownBinaryValue, DbExpression coordinateSystemId)
238public static DbFunctionExpression GeometryPointFromBinary(DbExpression pointWellKnownBinaryValue, DbExpression coordinateSystemId)
255public static DbFunctionExpression GeometryLineFromBinary(DbExpression lineWellKnownBinaryValue, DbExpression coordinateSystemId)
272public static DbFunctionExpression GeometryPolygonFromBinary(DbExpression polygonWellKnownBinaryValue, DbExpression coordinateSystemId)
293public static DbFunctionExpression GeometryMultiPointFromBinary(DbExpression multiPointWellKnownBinaryValue, DbExpression coordinateSystemId)
314public static DbFunctionExpression GeometryMultiLineFromBinary(DbExpression multiLineWellKnownBinaryValue, DbExpression coordinateSystemId)
333public static DbFunctionExpression GeometryMultiPolygonFromBinary(DbExpression multiPolygonWellKnownBinaryValue, DbExpression coordinateSystemId)
350public static DbFunctionExpression GeometryCollectionFromBinary(DbExpression geometryCollectionWellKnownBinaryValue, DbExpression coordinateSystemId)
370public static DbFunctionExpression GeometryFromGml(DbExpression geometryMarkup)
387public static DbFunctionExpression GeometryFromGml(DbExpression geometryMarkup, DbExpression coordinateSystemId)
407public static DbFunctionExpression GeographyFromText(DbExpression wellKnownText)
423public static DbFunctionExpression GeographyFromText(DbExpression wellKnownText, DbExpression coordinateSystemId)
440public static DbFunctionExpression GeographyPointFromText(DbExpression pointWellKnownText, DbExpression coordinateSystemId)
457public static DbFunctionExpression GeographyLineFromText(DbExpression lineWellKnownText, DbExpression coordinateSystemId)
474public static DbFunctionExpression GeographyPolygonFromText(DbExpression polygonWellKnownText, DbExpression coordinateSystemId)
495public static DbFunctionExpression GeographyMultiPointFromText(DbExpression multiPointWellKnownText, DbExpression coordinateSystemId)
516public static DbFunctionExpression GeographyMultiLineFromText(DbExpression multiLineWellKnownText, DbExpression coordinateSystemId)
535public static DbFunctionExpression GeographyMultiPolygonFromText(DbExpression multiPolygonWellKnownText, DbExpression coordinateSystemId)
552public static DbFunctionExpression GeographyCollectionFromText(DbExpression geographyCollectionWellKnownText, DbExpression coordinateSystemId)
573public static DbFunctionExpression GeographyFromBinary(DbExpression wellKnownBinaryValue)
589public static DbFunctionExpression GeographyFromBinary(DbExpression wellKnownBinaryValue, DbExpression coordinateSystemId)
606public static DbFunctionExpression GeographyPointFromBinary(DbExpression pointWellKnownBinaryValue, DbExpression coordinateSystemId)
623public static DbFunctionExpression GeographyLineFromBinary(DbExpression lineWellKnownBinaryValue, DbExpression coordinateSystemId)
640public static DbFunctionExpression GeographyPolygonFromBinary(DbExpression polygonWellKnownBinaryValue, DbExpression coordinateSystemId)
661public static DbFunctionExpression GeographyMultiPointFromBinary(DbExpression multiPointWellKnownBinaryValue, DbExpression coordinateSystemId)
682public static DbFunctionExpression GeographyMultiLineFromBinary(DbExpression multiLineWellKnownBinaryValue, DbExpression coordinateSystemId)
701public static DbFunctionExpression GeographyMultiPolygonFromBinary(DbExpression multiPolygonWellKnownBinaryValue, DbExpression coordinateSystemId)
718public static DbFunctionExpression GeographyCollectionFromBinary(DbExpression geographyCollectionWellKnownBinaryValue, DbExpression coordinateSystemId)
738public static DbFunctionExpression GeographyFromGml(DbExpression geographyMarkup)
755public static DbFunctionExpression GeographyFromGml(DbExpression geographyMarkup, DbExpression coordinateSystemId)
778public static DbFunctionExpression CoordinateSystemId(this DbExpression spatialValue)
793public static DbFunctionExpression SpatialTypeName(this DbExpression spatialValue)
808public static DbFunctionExpression SpatialDimension(this DbExpression spatialValue)
823public static DbFunctionExpression SpatialEnvelope(this DbExpression geometryValue)
838public static DbFunctionExpression AsBinary(this DbExpression spatialValue)
854public static DbFunctionExpression AsGml(this DbExpression spatialValue)
869public static DbFunctionExpression AsText(this DbExpression spatialValue)
884public static DbFunctionExpression IsEmptySpatial(this DbExpression spatialValue)
899public static DbFunctionExpression IsSimpleGeometry(this DbExpression geometryValue)
913public static DbFunctionExpression SpatialBoundary(this DbExpression geometryValue)
928public static DbFunctionExpression IsValidGeometry(this DbExpression geometryValue)
949public static DbFunctionExpression SpatialEquals(this DbExpression spatialValue1, DbExpression spatialValue2)
967public static DbFunctionExpression SpatialDisjoint(this DbExpression spatialValue1, DbExpression spatialValue2)
985public static DbFunctionExpression SpatialIntersects(this DbExpression spatialValue1, DbExpression spatialValue2)
1001public static DbFunctionExpression SpatialTouches(this DbExpression geometryValue1, DbExpression geometryValue2)
1017public static DbFunctionExpression SpatialCrosses(this DbExpression geometryValue1, DbExpression geometryValue2)
1033public static DbFunctionExpression SpatialWithin(this DbExpression geometryValue1, DbExpression geometryValue2)
1049public static DbFunctionExpression SpatialContains(this DbExpression geometryValue1, DbExpression geometryValue2)
1065public static DbFunctionExpression SpatialOverlaps(this DbExpression geometryValue1, DbExpression geometryValue2)
1082public static DbFunctionExpression SpatialRelate(this DbExpression geometryValue1, DbExpression geometryValue2, DbExpression intersectionPatternMatrix)
1103public static DbFunctionExpression SpatialBuffer(this DbExpression spatialValue, DbExpression distance)
1121public static DbFunctionExpression Distance(this DbExpression spatialValue1, DbExpression spatialValue2)
1136public static DbFunctionExpression SpatialConvexHull(this DbExpression geometryValue)
1153public static DbFunctionExpression SpatialIntersection(this DbExpression spatialValue1, DbExpression spatialValue2)
1171public static DbFunctionExpression SpatialUnion(this DbExpression spatialValue1, DbExpression spatialValue2)
1189public static DbFunctionExpression SpatialDifference(this DbExpression spatialValue1, DbExpression spatialValue2)
1207public static DbFunctionExpression SpatialSymmetricDifference(this DbExpression spatialValue1, DbExpression spatialValue2)
1226public static DbFunctionExpression SpatialElementCount(this DbExpression spatialValue)
1244public static DbFunctionExpression SpatialElementAt(this DbExpression spatialValue, DbExpression indexValue)
1264public static DbFunctionExpression XCoordinate(this DbExpression geometryValue)
1278public static DbFunctionExpression YCoordinate(this DbExpression geometryValue)
1292public static DbFunctionExpression Elevation(this DbExpression spatialValue)
1306public static DbFunctionExpression Measure(this DbExpression spatialValue)
1320public static DbFunctionExpression Latitude(this DbExpression geographyValue)
1334public static DbFunctionExpression Longitude(this DbExpression geographyValue)
1352public static DbFunctionExpression SpatialLength(this DbExpression spatialValue)
1366public static DbFunctionExpression StartPoint(this DbExpression spatialValue)
1380public static DbFunctionExpression EndPoint(this DbExpression spatialValue)
1394public static DbFunctionExpression IsClosedSpatial(this DbExpression spatialValue)
1408public static DbFunctionExpression IsRing(this DbExpression geometryValue)
1426public static DbFunctionExpression PointCount(this DbExpression spatialValue)
1443public static DbFunctionExpression PointAt(this DbExpression spatialValue, DbExpression indexValue)
1462public static DbFunctionExpression Area(this DbExpression spatialValue)
1477public static DbFunctionExpression Centroid(this DbExpression geometryValue)
1491public static DbFunctionExpression PointOnSurface(this DbExpression geometryValue)
1509public static DbFunctionExpression ExteriorRing(this DbExpression geometryValue)
1523public static DbFunctionExpression InteriorRingCount(this DbExpression geometryValue)
1540public static DbFunctionExpression InteriorRingAt(this DbExpression geometryValue, DbExpression indexValue)
System\Data\Common\CommandTrees\Internal\ExpressionPrinter.cs (15)
34internal string Print(DbExpression expr)
242internal TreeNode VisitExpression(DbExpression expr)
247internal TreeNode VisitExpression(string name, DbExpression expr)
257internal TreeNode VisitFunction(EdmFunction func, IList<DbExpression> args)
271private static TreeNode NodeFromExpression(DbExpression expr)
372private List<TreeNode> VisitParams(IList<string> paramInfo, IList<DbExpression> args)
385private void AppendArguments(TreeNode node, IList<string> paramNames, IList<DbExpression> args)
393private TreeNode VisitWithLabel(string label, string name, DbExpression def)
424private TreeNode Visit(string name, params DbExpression[] exprs)
427foreach (DbExpression expr in exprs)
434private TreeNode VisitInfix(DbExpression root, DbExpression left, string name, DbExpression right)
477public override TreeNode Visit(DbExpression e)
758foreach (DbExpression element in e.Arguments)
System\Data\Common\CommandTrees\Internal\PatternMatchRules.cs (55)
29private readonly Func<DbExpression, bool> isMatch;
30private readonly Func<DbExpression, DbExpression> process;
33private PatternMatchRule(Func<DbExpression, bool> matchFunc, Func<DbExpression, DbExpression> processor, ProcessedAction onProcessed)
40internal override bool ShouldProcess(DbExpression expression)
45internal override bool TryProcess(DbExpression expression, out DbExpression result)
59internal static PatternMatchRule Create(Func<DbExpression, bool> matchFunc, Func<DbExpression, DbExpression> processor)
67internal static PatternMatchRule Create(Func<DbExpression, bool> matchFunc, Func<DbExpression, DbExpression> processor, ProcessedAction onProcessed)
93private DbExpression Process(DbExpression expression)
105internal static Func<DbExpression, DbExpression> Create(params PatternMatchRule[] rules)
123internal static Func<DbExpression, bool> And(Func<DbExpression, bool> pattern1, Func<DbExpression, bool> pattern2)
131internal static Func<DbExpression, bool> And(Func<DbExpression, bool> pattern1, Func<DbExpression, bool> pattern2, Func<DbExpression, bool> pattern3)
139internal static Func<DbExpression, bool> Or(Func<DbExpression, bool> pattern1, Func<DbExpression, bool> pattern2)
147internal static Func<DbExpression, bool> Or(Func<DbExpression, bool> pattern1, Func<DbExpression, bool> pattern2, Func<DbExpression, bool> pattern3)
168internal static Func<DbExpression, bool> AnyExpression { get { return (e => true); } }
173internal static Func<IEnumerable<DbExpression>, bool> AnyExpressions { get { return (elems => true); } }
188internal static Func<DbExpression, bool> MatchComplexType { get { return (e => TypeSemantics.IsComplexType(e.ResultType)); } }
193internal static Func<DbExpression, bool> MatchEntityType { get { return (e => TypeSemantics.IsEntityType(e.ResultType)); } }
198internal static Func<DbExpression, bool> MatchRowType { get { return (e => TypeSemantics.IsRowType(e.ResultType)); } }
207internal static Func<DbExpression, bool> MatchKind(DbExpressionKind kindToMatch)
215internal static Func<IEnumerable<DbExpression>, bool> MatchForAll(Func<DbExpression, bool> elementPattern)
252internal static Func<DbExpression, bool> MatchBinary()
269internal static Func<DbExpression, bool> MatchFilter(Func<DbExpression, bool> inputPattern, Func<DbExpression, bool> predicatePattern)
277internal static Func<DbExpression, bool> MatchProject(Func<DbExpression, bool> inputPattern, Func<DbExpression, bool> projectionPattern)
285internal static Func<DbExpression, bool> MatchCase(Func<IEnumerable<DbExpression>, bool> whenPattern, Func<IEnumerable<DbExpression>, bool> thenPattern, Func<DbExpression, bool> elsePattern)
293internal static Func<DbExpression, bool> MatchNewInstance() { return (e => e.ExpressionKind == DbExpressionKind.NewInstance); }
298internal static Func<DbExpression, bool> MatchNewInstance(Func<IEnumerable<DbExpression>, bool> argumentsPattern)
System\Data\Common\CommandTrees\Internal\ViewSimplifier.cs (64)
76DbExpression queryExpression = view.Query;
85private static readonly Func<DbExpression, bool> Pattern_EntityConstructor =
100private DbExpression AddFkRelatedEntityRefs(DbExpression viewConstructor)
198List<DbExpression> conditions = null;
203conditions = new List<DbExpression>(discriminatedConstructor.When.Count);
243DbExpression result = null;
257List<DbExpression> whens = new List<DbExpression>(conditions.Count);
258List<DbExpression> thens = new List<DbExpression>(conditions.Count);
283IList<DbExpression> principalKeyValues = null;
335private static readonly Func<DbExpression, bool> Pattern_NestedTphDiscriminator =
413private static DbExpression SimplifyNestedTphDiscriminator(DbExpression expression)
420List<DbExpression> predicates = FlattenOr(booleanColumnFilter.Predicate).ToList();
444Dictionary<string, DbExpression> columnValues = new Dictionary<string, DbExpression>(rowConstructor.Arguments.Count);
448DbExpression columnVal = rowConstructor.Arguments[idx];
483DbExpression newDiscriminatorPredicate = Helpers.BuildBalancedTreeInPlace<DbExpression>(new List<DbExpression>(inputPredicateMap.Values), (left, right) => DbExpressionBuilder.Or(left, right));
487List<DbExpression> newWhens = new List<DbExpression>(entitySelector.When.Count);
488List<DbExpression> newThens = new List<DbExpression>(entitySelector.Then.Count);
502DbExpression inputBoundEntityConstructor = ValueSubstituter.Substitute(entityThen, entityProjection.Input.VariableName, columnValues);
506DbExpression newElse = ValueSubstituter.Substitute(entitySelector.Else, entityProjection.Input.VariableName, columnValues);
509DbExpression result = discriminatorFilter.BindAs(rowProjection.Input.VariableName).Project(newEntitySelector);
515internal static DbExpression Substitute(DbExpression original, string referencedVariable, Dictionary<string, DbExpression> propertyValues)
523private readonly Dictionary<string, DbExpression> replacements;
525private ValueSubstituter(string varName, Dictionary<string, DbExpression> replValues)
534public override DbExpression Visit(DbPropertyExpression expression)
536DbExpression result = null;
538DbExpression replacementValue;
560private static readonly Func<DbExpression, bool> Pattern_Case = Patterns.MatchKind(DbExpressionKind.Case);
562private static DbExpression SimplifyCaseStatement(DbExpression expression)
568List<DbExpression> rewrittenPredicates = new List<DbExpression>(caseExpression.When.Count);
569foreach (var when in caseExpression.When)
571DbExpression simplifiedPredicate;
589private static bool TrySimplifyPredicate(DbExpression predicate, out DbExpression simplified)
617private static readonly Func<DbExpression, bool> Pattern_CollapseNestedProjection =
629private static DbExpression CollapseNestedProjection(DbExpression expression)
632DbExpression outerProjection = outerProject.Projection;
638Dictionary<string, DbExpression> bindings = new Dictionary<string, DbExpression>(innerNew.Arguments.Count);
652var replacementOuterProjection = collapser.CollapseProjection(outerProjection);
705private Dictionary<string, DbExpression> m_varRefMemberBindings;
708internal ProjectionCollapser(Dictionary<string, DbExpression> varRefMemberBindings,
718internal DbExpression CollapseProjection(DbExpression expression)
723public override DbExpression Visit(DbPropertyExpression property)
734public override DbExpression Visit(DbVariableReferenceExpression varRef)
765internal static IEnumerable<DbExpression> FlattenOr(DbExpression expression)
777foreach (var term in FlattenOr(filter.Predicate))
802internal static bool TryMatchPropertyEqualsValue(DbExpression expression, string propertyVariable, out DbPropertyExpression property, out object value)
820private static bool TryMatchConstant(DbExpression expression, out object value)
System\Data\Common\CommandTrees\OperatorExpressions.cs (31)
29internal DbAndExpression(TypeUsage booleanResultType, DbExpression left, DbExpression right)
59internal DbOrExpression(TypeUsage booleanResultType, DbExpression left, DbExpression right)
89internal DbNotExpression(TypeUsage booleanResultType, DbExpression argument)
152/// The <code>Arguments</code> property returns a fixed-size list of <see cref="DbExpression"/> elements.
156public IList<DbExpression> Arguments { get { return _args; } }
183private readonly DbExpression _else;
185internal DbCaseExpression(TypeUsage commonResultType, DbExpressionList whens, DbExpressionList thens, DbExpression elseExpr)
201public IList<DbExpression> When { get { return _when; } }
206public IList<DbExpression> Then { get { return _then; } }
211public DbExpression Else { get { return _else; } }
236internal DbCastExpression(TypeUsage type, DbExpression argument)
271internal DbComparisonExpression(DbExpressionKind kind, TypeUsage booleanResultType, DbExpression left, DbExpression right)
311internal DbIsEmptyExpression(TypeUsage booleanResultType, DbExpression argument)
340internal DbIsNullExpression(TypeUsage booleanResultType, DbExpression arg, bool isRowTypeArgumentAllowed)
371internal DbIsOfExpression(DbExpressionKind isOfKind, TypeUsage booleanResultType, DbExpression argument, TypeUsage isOfType)
413internal DbOfTypeExpression(DbExpressionKind ofTypeKind, TypeUsage collectionResultType, DbExpression argument, TypeUsage type)
457internal DbTreatExpression(TypeUsage asType, DbExpression argument)
486private readonly DbExpression _argument;
487private readonly DbExpression _pattern;
488private readonly DbExpression _escape;
490internal DbLikeExpression(TypeUsage booleanResultType, DbExpression input, DbExpression pattern, DbExpression escape)
509public DbExpression Argument { get { return _argument; } }
514public DbExpression Pattern { get { return _pattern; } }
519public DbExpression Escape { get { return _escape; } }
544internal DbEntityRefExpression(TypeUsage refResultType, DbExpression entity)
573internal DbRefKeyExpression(TypeUsage rowResultType, DbExpression reference)
System\Data\Common\CommandTrees\RelationalExpressions.cs (39)
78internal DbDistinctExpression(TypeUsage resultType, DbExpression argument)
113internal DbElementExpression(TypeUsage resultType, DbExpression argument)
119internal DbElementExpression(TypeUsage resultType, DbExpression argument, bool unwrapSingleProperty)
157internal DbExceptExpression(TypeUsage resultType, DbExpression left, DbExpression right)
187private readonly DbExpression _predicate;
189internal DbFilterExpression(TypeUsage resultType, DbExpressionBinding input, DbExpression predicate)
206/// Gets the <see cref="DbExpression"/> that specifies the predicate used to filter the input set.
208public DbExpression Predicate { get { return _predicate; } }
259/// Gets an <see cref="DbExpression"/> list that provides grouping keys.
261public IList<DbExpression> Keys { get { return _keys; } }
294internal DbIntersectExpression(TypeUsage resultType, DbExpression left, DbExpression right)
363private readonly DbExpression _condition;
365internal DbJoinExpression(DbExpressionKind joinKind, TypeUsage collectionOfRowResultType, DbExpressionBinding left, DbExpressionBinding right, DbExpression condition)
392/// Gets the <see cref="DbExpression"/> that defines the join condition to apply.
394public DbExpression JoinCondition { get { return _condition; } }
419private readonly DbExpression _argument;
420private readonly DbExpression _limit;
423internal DbLimitExpression(TypeUsage resultType, DbExpression argument, DbExpression limit, bool withTies)
438public DbExpression Argument { get { return this._argument; } }
443public DbExpression Limit { get { return this._limit; } }
474private readonly DbExpression _projection;
476internal DbProjectExpression(TypeUsage resultType, DbExpressionBinding input, DbExpression projection)
492/// Gets the <see cref="DbExpression"/> that defines the projection.
494public DbExpression Projection { get { return _projection; } }
520private readonly DbExpression _predicate;
522internal DbQuantifierExpression(DbExpressionKind kind, TypeUsage booleanResultType, DbExpressionBinding input, DbExpression predicate)
542public DbExpression Predicate { get { return _predicate; } }
567private readonly DbExpression _expr;
571internal DbSortClause(DbExpression key, bool asc, string collation)
591/// Gets the <see cref="DbExpression"/> that provides the value for this sort key.
593public DbExpression Expression { get { return _expr; } }
604private readonly DbExpression _count;
606internal DbSkipExpression(TypeUsage resultType, DbExpressionBinding input, System.Collections.ObjectModel.ReadOnlyCollection<DbSortClause> sortOrder, DbExpression count)
632public DbExpression Count
710internal DbUnionAllExpression(TypeUsage resultType, DbExpression left, DbExpression right)
System\Data\Common\CommandTrees\ValueExpressions.cs (22)
211private readonly DbExpression _instance;
213internal DbPropertyExpression(TypeUsage resultType, EdmMember property, DbExpression instance)
232/// Gets the <see cref="DbExpression"/> that defines the instance from which the property should be retrieved.
234public DbExpression Instance { get { return _instance; } }
257public KeyValuePair<string, DbExpression> ToKeyValuePair()
259return new KeyValuePair<string, DbExpression>(this.Property.Name, this);
262public static implicit operator KeyValuePair<string, DbExpression>(DbPropertyExpression value)
295/// Gets an <see cref="DbExpression"/> list that provides the arguments to the function.
297public IList<DbExpression> Arguments { get { return this._arguments; } }
343/// Gets a <see cref="DbExpression"/> list that provides the arguments to which the Lambda function should be applied.
345public IList<DbExpression> Arguments { get { return this._arguments; } }
488private readonly DbExpression _from;
495DbExpression navigateFrom)
525/// Gets the <see cref="DbExpression"/> that specifies the instance of the 'from' relationship end from which navigation should occur.
527public DbExpression NavigationSource { get { return _from; } }
559private readonly DbExpression _targetEntityRef;
561internal DbRelatedEntityRef(RelationshipEndMember sourceEnd, RelationshipEndMember targetEnd, DbExpression targetEntityRef)
626internal DbExpression TargetEntityReference { get { return _targetEntityRef; } }
657/// Gets an <see cref="DbExpression"/> list that provides the property/column values or set elements for the new instance.
659public IList<DbExpression> Arguments { get { return _elements; } }
695internal DbRefExpression(TypeUsage refResultType, EntitySet entitySet, DbExpression refKeys)
731internal DbDerefExpression(TypeUsage entityResultType, DbExpression refExpr)
System\Data\Common\EntitySql\SemanticAnalyzer.cs (220)
78/// Converts query command AST into a <see cref="DbExpression"/>.
104DbExpression expression = ConvertQueryStatementToDbExpression(astQueryCommandExpr.Statement, _sr, out functionDefs);
240DbExpression converted = ConvertQueryStatementToDbExpression(astStatement, sr, out functionDefs);
251/// Converts the query statement to a normalized and validated <see cref="DbExpression"/>.
253/// query command tree or producing only a <see cref="DbExpression"/>.
258/// An instance of <see cref="DbExpression"/>, adjusted to handle 'inline' projections
261private static DbExpression ConvertQueryStatementToDbExpression(AST.Statement astStatement, SemanticResolver sr, out List<FunctionDefinition> functionDefs)
281DbExpression converted = ConvertValueExpressionAllowUntypedNulls(queryStatement.Expr, sr);
480DbExpression body = ConvertValueExpression(functionInfo.FunctionDefAst.Body, sr);
512private static DbExpression ConvertValueExpression(AST.Node astExpr, SemanticResolver sr)
514var expr = ConvertValueExpressionAllowUntypedNulls(astExpr, sr);
528private static DbExpression ConvertValueExpressionAllowUntypedNulls(AST.Node astExpr, SemanticResolver sr)
571private static Pair<DbExpression, DbExpression> ConvertValueExpressionsWithUntypedNulls(AST.Node leftAst,
577var leftExpr = leftAst != null ? ConvertValueExpressionAllowUntypedNulls(leftAst, sr) : null;
578var rightExpr = rightAst != null ? ConvertValueExpressionAllowUntypedNulls(rightAst, sr) : null;
596return new Pair<DbExpression, DbExpression>(leftExpr, rightExpr);
702DbExpression converted = ConvertValueExpressionAllowUntypedNulls(innerExpr, sr);
713DbExpression converted = null;
731DbExpression arg;
752DbExpression definition = aggregateInfo.EvaluatingScopeRegion.GroupAggregateBinding.Project(arg);
1077private static DbExpression ConvertAggregateFunctionInGroupScope(AST.MethodExpr methodExpr, MetadataFunctionGroup metadataFunctionGroup, SemanticResolver sr)
1079DbExpression converted = null;
1142private static bool TryConvertAsResolvedGroupAggregate(AST.GroupAggregateExpr groupAggregateExpr, SemanticResolver sr, out DbExpression converted)
1184out DbExpression converted)
1232out DbExpression converted)
1266List<DbExpression> args;
1321/// Creates <see cref="DbExpression"/> representing a new instance of the given type.
1324private static DbExpression CreateConstructorCallExpression(AST.MethodExpr methodExpr,
1326List<DbExpression> args,
1332DbExpression newInstance = null;
1497/// Converts function call arguments into a list of <see cref="DbExpression"/>s.
1500private static List<DbExpression> ConvertFunctionArguments(AST.NodeList<AST.Node> astExprList, SemanticResolver sr, out List<TypeUsage> argTypes)
1502List<DbExpression> convertedArgs = new List<DbExpression>();
1517List<DbExpression> args,
1569var targetEntityRef = ConvertValueExpression(relshipExpr.RefExpr, sr);
1686var sourceEntityRef = ConvertValueExpression(relshipExpr.RefExpr, sr);
1787DbExpression converted = sourceEntityRef.Navigate(fromEnd, toEnd);
1800DbExpression converted = ConvertValueExpression(refExpr.ArgExpr, sr);
1826DbExpression converted = null;
1854DbExpression converted = null;
1874DbExpression keyRowExpression = ConvertValueExpression(createRefExpr.Keys, sr);
1943DbExpression converted = ConvertValueExpression(keyExpr.ArgExpr, sr);
1982private static Pair<DbExpression, DbExpression> ConvertArithmeticArgs(AST.BuiltInExpr astBuiltInExpr, SemanticResolver sr)
2019private static Pair<DbExpression, DbExpression> ConvertPlusOperands(AST.BuiltInExpr astBuiltInExpr, SemanticResolver sr)
2053private static Pair<DbExpression, DbExpression> ConvertLogicalArgs(AST.BuiltInExpr astBuiltInExpr, SemanticResolver sr)
2055DbExpression leftExpr = ConvertValueExpressionAllowUntypedNulls(astBuiltInExpr.Arg1, sr);
2061DbExpression rightExpr = null;
2087return new Pair<DbExpression, DbExpression>(leftExpr, rightExpr);
2096private static Pair<DbExpression, DbExpression> ConvertEqualCompArgs(AST.BuiltInExpr astBuiltInExpr, SemanticResolver sr)
2101Pair<DbExpression, DbExpression> compArgs = ConvertValueExpressionsWithUntypedNulls(
2126private static Pair<DbExpression, DbExpression> ConvertOrderCompArgs(AST.BuiltInExpr astBuiltInExpr, SemanticResolver sr)
2128Pair<DbExpression, DbExpression> compArgs = ConvertValueExpressionsWithUntypedNulls(
2153private static Pair<DbExpression, DbExpression> ConvertSetArgs(AST.BuiltInExpr astBuiltInExpr, SemanticResolver sr)
2158DbExpression leftExpr = ConvertValueExpression(astBuiltInExpr.Arg1, sr);
2163DbExpression rightExpr = null;
2261return new Pair<DbExpression, DbExpression>(leftExpr, rightExpr);
2271private static Pair<DbExpression, DbExpression> ConvertInExprArgs(AST.BuiltInExpr astBuiltInExpr, SemanticResolver sr)
2273DbExpression rightExpr = ConvertValueExpression(astBuiltInExpr.Arg2, sr);
2279DbExpression leftExpr = ConvertValueExpressionAllowUntypedNulls(astBuiltInExpr.Arg1, sr);
2304return new Pair<DbExpression, DbExpression>(leftExpr, rightExpr);
2535List<DbExpression> fieldExprs = new List<DbExpression>(rowExpr.AliasedExprList.Count);
2541DbExpression colExpr = ConvertValueExpressionAllowUntypedNulls(aliasExpr.Expr, sr);
2627List<DbExpression> whenExprList = new List<DbExpression>(caseExpr.WhenThenExprList.Count);
2628List<DbExpression> thenExprList = new List<DbExpression>(caseExpr.WhenThenExprList.Count);
2637DbExpression whenExpression = ConvertValueExpression(whenThenExpr.WhenExpr, sr);
2646DbExpression thenExpression = ConvertValueExpressionAllowUntypedNulls(whenThenExpr.ThenExpr, sr);
2654DbExpression elseExpr = caseExpr.ElseExpr != null ? ConvertValueExpressionAllowUntypedNulls(caseExpr.ElseExpr, sr) : null;
2716DbExpression converted = null;
2791private static DbExpression ProcessSelectClause(DbExpressionBinding source, AST.QueryExpr queryExpr, bool queryProjectionProcessed, SemanticResolver sr)
2795DbExpression projectExpression;
2835DbExpression convertedLimit = ConvertValueExpression(limitExpr, sr);
2852private static List<KeyValuePair<string, DbExpression>> ConvertSelectClauseItems(AST.QueryExpr queryExpr, SemanticResolver sr)
2879List<KeyValuePair<string, DbExpression>> projectionItems = new List<KeyValuePair<string, DbExpression>>(selectClause.Items.Count);
2884DbExpression converted = ConvertValueExpression(projectionItem.Expr, sr);
2907projectionItems.Add(new KeyValuePair<string, DbExpression>(aliasName, converted));
2914private static DbExpression CreateProjectExpression(DbExpressionBinding source, AST.SelectClause selectClause, List<KeyValuePair<string, DbExpression>> projectionItems)
2919DbExpression projectExpression;
2981private static void ValidateExpressionIsCommandParamOrNonNegativeIntegerConstant(DbExpression expr, ErrorContext errCtx, string exprName, SemanticResolver sr)
3082DbExpression converted = ConvertValueExpression(aliasedExpr.Expr, sr);
3204DbExpression onExpr = null;
3332DbExpression filterConditionExpr = ConvertValueExpression(predicate, sr);
3436DbExpression keyExpr;
3465DbExpression keyExprForFunctionAggregates;
3477DbExpression keyExprForGroupPartitions;
3593DbExpression converted = ConvertValueExpression(queryExpr.HavingClause.HavingPredicate, sr);
3599Dictionary<string, DbExpression> projectionExpressions = null;
3602projectionExpressions = new Dictionary<string, DbExpression>(queryExpr.SelectClause.Items.Count, sr.NameComparer);
3610DbExpression converted = ConvertValueExpression(aliasedExpr.Expr, sr);
3653foreach (KeyValuePair<string, DbExpression> kvp in projectionExpressions)
3667DbExpression converted = ConvertValueExpression(orderItem.OrderExpr, sr);
3759groupKeys.Select(keyInfo => new KeyValuePair<string, DbExpression>(keyInfo.Name, keyInfo.VarBasedKeyExpr)),
3780List<KeyValuePair<string, DbExpression>> projectionItems = ProcessGroupPartitionDefinitions(
3791new KeyValuePair<string, DbExpression>(keyInfo.Name, groupBinding.Variable.Property(keyInfo.Name))));
3798.Select(groupAggregateInfo => new KeyValuePair<string, DbExpression>(
3802DbExpression projectExpression = DbExpressionBuilder.NewRow(projectionItems);
3886private static List<KeyValuePair<string, DbExpression>> ProcessGroupPartitionDefinitions(
3894List<KeyValuePair<string, DbExpression>> groupPartitionDefinitions = new List<KeyValuePair<string, DbExpression>>();
3900DbExpression aggregateDefinition = ((GroupPartitionInfo)groupAggregateInfo).AggregateDefinition;
3915groupPartitionDefinitions.Add(new KeyValuePair<string, DbExpression>(
3929groupPartitionDefinitions.Add(new KeyValuePair<string, DbExpression>(
3950private static bool IsTrivialInputProjection(DbVariableReferenceExpression lambdaVariable, DbExpression lambdaBody)
4006internal GroupKeyInfo(string name, DbExpression varBasedKeyExpr, DbExpression groupVarBasedKeyExpr, DbExpression groupAggBasedKeyExpr)
4039internal readonly DbExpression VarBasedKeyExpr;
4041internal readonly DbExpression GroupVarBasedKeyExpr;
4043internal readonly DbExpression GroupAggBasedKeyExpr;
4067DbExpression convertedSkip = null;
4125DbExpression projectExpression = CreateProjectExpression(source, selectClause, projectionItems);
4170DbExpression keyExpr = ConvertValueExpression(orderClauseItem.OrderExpr, sr);
4229DbExpression sortSourceExpr = null;
4306private static DbExpression ConvertSimpleInExpression(SemanticResolver sr, DbExpression left, DbExpression right)
4318List<DbExpression> args = new List<DbExpression>(predicates);
4319DbExpression orExpr = Utils.Helpers.BuildBalancedTreeInPlace(args, (prev, next) => prev.Or(next));
4343private delegate DbExpression BuiltInExprConverter(AST.BuiltInExpr astBltInExpr, SemanticResolver sr);
4385Pair<DbExpression, DbExpression> args = ConvertPlusOperands(bltInExpr, sr);
4430Pair<DbExpression, DbExpression> args = ConvertArithmeticArgs(bltInExpr, sr);
4442Pair<DbExpression, DbExpression> args = ConvertArithmeticArgs(bltInExpr, sr);
4454Pair<DbExpression, DbExpression> args = ConvertArithmeticArgs(bltInExpr, sr);
4466Pair<DbExpression, DbExpression> args = ConvertArithmeticArgs(bltInExpr, sr);
4478DbExpression argument = ConvertArithmeticArgs(bltInExpr, sr).Left;
4488DbExpression unaryExpr = argument.UnaryMinus();
4514Pair<DbExpression, DbExpression> args = SemanticAnalyzer.ConvertLogicalArgs(bltInExpr, sr);
4527Pair<DbExpression, DbExpression> args = SemanticAnalyzer.ConvertLogicalArgs(bltInExpr, sr);
4554Pair<DbExpression, DbExpression> args = ConvertEqualCompArgs(bltInExpr, sr);
4566Pair<DbExpression, DbExpression> args = ConvertEqualCompArgs(bltInExpr, sr);
4580Pair<DbExpression, DbExpression> args = ConvertOrderCompArgs(bltInExpr, sr);
4592Pair<DbExpression, DbExpression> args = ConvertOrderCompArgs(bltInExpr, sr);
4604Pair<DbExpression, DbExpression> args = ConvertOrderCompArgs(bltInExpr, sr);
4616Pair<DbExpression, DbExpression> args = ConvertOrderCompArgs(bltInExpr, sr);
4634Pair<DbExpression, DbExpression> args = ConvertSetArgs(bltInExpr, sr);
4646Pair<DbExpression, DbExpression> args = ConvertSetArgs(bltInExpr, sr);
4658Pair<DbExpression, DbExpression> args = ConvertSetArgs(bltInExpr, sr);
4670Pair<DbExpression, DbExpression> args = ConvertSetArgs(bltInExpr, sr);
4702Pair<DbExpression, DbExpression> args = ConvertSetArgs(bltInExpr, sr);
4724DbExpression elemExpr = ConvertValueExpression(bltInExpr.Arg1, sr);
4752Pair<DbExpression, DbExpression> args = ConvertInExprArgs(bltInExpr, sr);
4765DbExpression leftIn = args.Left;
4766DbExpression rightSet = rSet.Variable;
4768DbExpression exists = rSet.Filter(leftIn.Equal(rightSet)).IsEmpty().Not();
4770List<DbExpression> whenExpr = new List<DbExpression>(1);
4772List<DbExpression> thenExpr = new List<DbExpression>(1);
4775DbExpression left = DbExpressionBuilder.Case(whenExpr, thenExpr, DbExpressionBuilder.False);
4777DbExpression converted = left.Or(exists);
4790Pair<DbExpression, DbExpression> args = ConvertInExprArgs(bltInExpr, sr);
4800DbExpression leftIn = args.Left;
4801DbExpression rightSet = rSet.Variable;
4803DbExpression exists = rSet.Filter(leftIn.Equal(rightSet)).IsEmpty();
4805List<DbExpression> whenExpr = new List<DbExpression>(1);
4807List<DbExpression> thenExpr = new List<DbExpression>(1);
4810DbExpression left = DbExpressionBuilder.Case(whenExpr, thenExpr, DbExpressionBuilder.True);
4812DbExpression converted = left.And(exists);
4825Pair<DbExpression, DbExpression> args = ConvertSetArgs(bltInExpr, sr);
4842DbExpression isNullExpr = ConvertValueExpressionAllowUntypedNulls(bltInExpr.Arg1, sr);
4852return isNullExpr != null ? (DbExpression)isNullExpr.IsNull() : DbExpressionBuilder.True;
4862DbExpression isNullExpr = ConvertValueExpressionAllowUntypedNulls(bltInExpr.Arg1, sr);
4872return isNullExpr != null ? (DbExpression)isNullExpr.IsNull().Not() : DbExpressionBuilder.False;
4886var exprToFilter = ConvertValueExpression(bltInExpr.Arg1, sr);
4939DbExpression retExpr = null;
4964var exprToTreat = ConvertValueExpressionAllowUntypedNulls(bltInExpr.Arg1, sr);
5029var exprToCast = ConvertValueExpressionAllowUntypedNulls(bltInExpr.Arg1, sr);
5068var exprToFilter = ConvertValueExpression(bltInExpr.Arg1, sr);
5113DbExpression ofTypeExpression = null;
5133DbExpression likeExpr = null;
5135DbExpression matchExpr = ConvertValueExpressionAllowUntypedNulls(bltInExpr.Arg1, sr);
5145DbExpression patternExpr = ConvertValueExpressionAllowUntypedNulls(bltInExpr.Arg2, sr);
5157DbExpression escapeExpr = ConvertValueExpressionAllowUntypedNulls(bltInExpr.Arg3, sr);
5198private static DbExpression ConvertBetweenExpr(AST.BuiltInExpr bltInExpr, SemanticResolver sr)
5206Pair<DbExpression, DbExpression> limitsExpr = ConvertValueExpressionsWithUntypedNulls(
5233DbExpression valueExpr = ConvertValueExpressionAllowUntypedNulls(bltInExpr.Arg1, sr);
System\Data\Common\EntitySql\SemanticResolver.cs (16)
60internal ValueExpression(DbExpression value)
72internal readonly DbExpression Value;
312private DbExpression GetExpressionFromScopeEntry(ScopeEntry scopeEntry, int scopeIndex, string varName, ErrorContext errCtx)
384DbExpression expr = scopeEntry.GetExpression(varName, errCtx);
586internal ValueExpression ResolvePropertyAccess(DbExpression valueExpr, string name, ErrorContext errCtx)
588DbExpression propertyExpr;
613private bool TryResolveAsPropertyAccess(DbExpression valueExpr, string name, ErrorContext errCtx, out DbExpression propertyExpr)
637private bool TryResolveAsRefPropertyAccess(DbExpression valueExpr, string name, ErrorContext errCtx, out DbExpression propertyExpr)
645DbExpression derefExpr = valueExpr.Deref();
716internal bool TryResolveInternalAggregateName(string name, ErrorContext errCtx, out DbExpression dbExpression)
785private string CreateNewAlias(DbExpression expr)
812internal string InferAliasName(AST.AliasedExpr aliasedExpr, DbExpression convertedExpression)
1480internal void AttachToAstNode(string aggregateName, DbExpression aggregateDefinition)
1487internal DbExpression AggregateDefinition;
System\Data\Mapping\FunctionImportMappingComposable.cs (37)
221DbExpression storeFunctionInvoke = this.TargetFunction.Invoke(GetParametersForTargetFunctionCall());
224DbExpression queryExpression;
250private IEnumerable<DbExpression> GetParametersForTargetFunctionCall()
271private DbExpression GenerateStructuralTypeResultMappingView(DbExpression storeFunctionInvoke, IList<EdmSchemaError> errors, out DiscriminatorMap discriminatorMap)
280DbExpression queryExpression = storeFunctionInvoke;
296var entityTypeMappingView = GenerateStructuralTypeMappingView(type, propertyMappings, binding.Variable, errors);
311List<DbExpression> structuralTypePredicates = m_structuralTypeMappings.Select(m => GenerateStructuralTypeConditionsPredicate(m.Item2, binding.Variable)).ToList();
317List<DbExpression> structuralTypeMappingViews = new List<DbExpression>(m_structuralTypeMappings.Count);
323var structuralTypeMappingView = GenerateStructuralTypeMappingView(type, propertyMappings, binding.Variable, errors);
341DbExpression typeConstructors = DbExpressionBuilder.Case(
357private DbExpression GenerateStructuralTypeMappingView(StructuralType structuralType, List<StoragePropertyMapping> propertyMappings, DbExpression row, IList<EdmSchemaError> errors)
362var constructorArgs = new List<DbExpression>(properties.Count);
367var propertyMappingView = GeneratePropertyMappingView(propertyMapping, row, new List<string>() { propertyMapping.EdmProperty.Name }, errors);
385private DbExpression GenerateStructuralTypeConditionsPredicate(List<StorageConditionPropertyMapping> conditions, DbExpression row)
388DbExpression predicate = Helpers.BuildBalancedTreeInPlace(conditions.Select(c => GeneratePredicate(c, row)).ToArray(), (prev, next) => prev.And(next));
392private DbExpression GeneratePredicate(StorageConditionPropertyMapping condition, DbExpression row)
395DbExpression columnRef = GenerateColumnRef(row, condition.ColumnProperty);
399return condition.IsNull.Value ? (DbExpression)columnRef.IsNull() : (DbExpression)columnRef.IsNull().Not();
407private DbExpression GeneratePropertyMappingView(StoragePropertyMapping mapping, DbExpression row, List<string> context, IList<EdmSchemaError> errors)
414private DbExpression GenerateScalarPropertyMappingView(EdmProperty edmProperty, EdmProperty columnProperty, DbExpression row)
416DbExpression accessorExpr = GenerateColumnRef(row, columnProperty);
424private DbExpression GenerateColumnRef(DbExpression row, EdmProperty column)
434private DbExpression GenerateScalarResultMappingView(DbExpression storeFunctionInvoke)
436DbExpression queryExpression = storeFunctionInvoke;
450Func<DbExpression, DbExpression> scalarView = (DbExpression row) =>
System\Data\Mapping\Update\Internal\UpdateCompiler.cs (16)
64DbExpression predicate = BuildPredicate(target, oldRow, null, processor, ref rowMustBeTouched);
91DbExpression returning;
101DbExpression predicate = BuildPredicate(target, oldRow, newRow, processor, ref rowMustBeTouched);
149DbExpression returning;
190PropagatorResult originalRow, TableChangeProcessor processor, bool insertMode, out Dictionary<int, string> outputIdentifiers, out DbExpression returning,
194List<KeyValuePair<string, DbExpression>> returningArguments = new List<KeyValuePair<string, DbExpression>>();
252returningArguments.Add(new KeyValuePair<string, DbExpression>(property.Name, propertyExpression));
362private DbExpression BuildPredicate(DbExpressionBinding target, PropagatorResult referenceRow, PropagatorResult current,
395DbExpression predicate = null;
398DbExpression clauseExpression = GenerateEqualityExpression(target, clause.Key, clause.Value);
411private DbExpression GenerateEqualityExpression(DbExpressionBinding target, EdmProperty property, PropagatorResult value)
415DbExpression propertyExpression = GeneratePropertyExpression(target, property);
416DbExpression valueExpression = GenerateValueExpression(property, value);
426private static DbExpression GeneratePropertyExpression(DbExpressionBinding target, EdmProperty property)
435private DbExpression GenerateValueExpression(EdmProperty property, PropagatorResult value)
System\Data\Mapping\ViewGeneration\DiscriminatorMap.cs (19)
47internal readonly System.Collections.ObjectModel.ReadOnlyCollection<KeyValuePair<EdmProperty, DbExpression>> PropertyMap;
52internal readonly System.Collections.ObjectModel.ReadOnlyCollection<KeyValuePair<Query.InternalTrees.RelProperty, DbExpression>> RelPropertyMap;
61Dictionary<EdmProperty, DbExpression> propertyMap,
62Dictionary<Query.InternalTrees.RelProperty, DbExpression> relPropertyMap,
75internal static bool TryCreateDiscriminatorMap(EntitySet entitySet, DbExpression queryView, out DiscriminatorMap discriminatorMap)
97var propertyMap = new Dictionary<EdmProperty, DbExpression>();
98var relPropertyMap = new Dictionary<Query.InternalTrees.RelProperty, DbExpression>();
105var when = caseExpression.When[i];
106var then = caseExpression.Then[i];
158Dictionary<Query.InternalTrees.RelProperty, DbExpression> relPropertyMap,
183private static bool TryMatchEntityTypeConstructor(DbExpression then,
184Dictionary<EdmProperty, DbExpression> propertyMap,
185Dictionary<Query.InternalTrees.RelProperty, DbExpression> relPropertyMap,
202var assignment = constructor.Arguments[j];
203DbExpression existingAssignment;
227DbExpression assignment = relatedRef.TargetEntityReference;
228DbExpression existingAssignment;
253private static bool ExpressionsCompatible(DbExpression x, DbExpression y)
System\Data\Objects\ELinq\ExpressionConverter.cs (91)
39private Dictionary<DbExpression, Span> _spanMappings;
234internal DbExpression Convert()
236DbExpression result = this.TranslateExpression(_expression);
345private DbExpression AddSpanMapping(DbExpression expression, Span span)
351_spanMappings = new Dictionary<DbExpression, Span>();
377private bool TryGetSpan(DbExpression expression, out Span span)
397private void ApplySpanMapping(DbExpression from, DbExpression to)
421private void UnifySpanMappings(DbExpression left, DbExpression right, DbExpression to)
445private DbDistinctExpression Distinct(DbExpression argument)
452private DbExceptExpression Except(DbExpression left, DbExpression right)
459private DbExpression Filter(DbExpressionBinding input, DbExpression predicate)
461DbExpression retExpr = _orderByLifter.Filter(input, predicate);
466private DbIntersectExpression Intersect(DbExpression left, DbExpression right)
473private DbExpression Limit(DbExpression argument, DbExpression limit)
475DbExpression retExpr = _orderByLifter.Limit(argument, limit);
480private DbExpression OfType(DbExpression argument, TypeUsage ofType)
482DbExpression retExpr = _orderByLifter.OfType(argument, ofType);
487private DbExpression Project(DbExpressionBinding input, DbExpression projection)
489DbExpression retExpr = _orderByLifter.Project(input, projection);
506private DbExpression Skip(DbExpressionBinding input, DbExpression skipCount)
508DbExpression retExpr = _orderByLifter.Skip(input, skipCount);
513private DbUnionAllExpression UnionAll(DbExpression left, DbExpression right)
650private DbExpression TranslateInlineQueryOfT(ObjectQuery inlineQuery)
672DbExpression resultExpression = null;
715internal static DbExpression RemoveParameterReferences(DbExpression expression, ObjectParameterCollection availableParameters)
730public override DbExpression Visit(DbParameterReferenceExpression expression)
751private DbExpression CreateCastExpression(DbExpression source, Type toClrType, Type fromClrType)
754DbExpression setSource = NormalizeSetSource(source);
778private DbExpression TranslateLambda(LambdaExpression lambda, DbExpression input, out DbExpressionBinding binding)
790private DbExpression TranslateLambda(LambdaExpression lambda, DbExpression input, string bindingName, out DbExpressionBinding binding)
802private DbExpression TranslateLambda(LambdaExpression lambda, DbExpression input, out DbGroupExpressionBinding binding)
815private DbExpression TranslateLambda(LambdaExpression lambda, DbExpression input)
827DbExpression result = TranslateExpression(lambda.Body);
841private DbExpression NormalizeSetSource(DbExpression input)
899private DbExpression TranslateSet(Expression linq)
905private DbExpression TranslateExpression(Expression linq)
909DbExpression result;
928private DbExpression AlignTypes(DbExpression cqt, Type toClrType)
1168private DbExpression CreateIsNullExpression(DbExpression operand, Type operandClrType)
1178private DbExpression CreateEqualsExpression(DbExpression left, DbExpression right, EqualsPattern pattern, Type leftClrType, Type rightClrType)
1199private DbExpression RecursivelyRewriteEqualsExpression(DbExpression left, DbExpression right, EqualsPattern pattern)
1209DbExpression shreddedEquals = null;
1215DbExpression elementsEquals = RecursivelyRewriteEqualsExpression(
1247private DbExpression ImplementEquality(DbExpression left, DbExpression right, EqualsPattern pattern)
1285private DbExpression ImplementEqualityConstantAndUnknown(
1286System.Data.Common.CommandTrees.DbConstantExpression constant, DbExpression unknown, EqualsPattern pattern)
1306private DbExpression ImplementEqualityUnknownArguments(DbExpression left, DbExpression right, EqualsPattern pattern)
1353private DbExpression TranslateFunctionIntoLike(MethodCallExpression call, bool insertPercentAtStart, bool insertPercentAtEnd, Func<ExpressionConverter, MethodCallExpression, DbExpression, DbExpression, DbExpression> defaultTranslator)
1371DbExpression translatedPatternExpression = this.TranslateExpression(patternExpression);
1372DbExpression translatedInputExpression = this.TranslateExpression(inputExpression);
1386DbExpression result;
1455DbExpression[] translatedArguments = new DbExpression[linqArguments.Length];
1470private DbFunctionExpression CreateCanonicalFunction(string functionName, Expression Expression, params DbExpression[] translatedArguments)
1473foreach (DbExpression translatedArgument in translatedArguments)
1572private DbNewInstanceExpression CreateNewRowExpression(List<KeyValuePair<string, DbExpression>> columns, InitializerMetadata initializerMetadata)
1574List<DbExpression> propertyValues = new List<DbExpression>(columns.Count);
System\Data\Objects\ELinq\MethodCallTranslator.cs (284)
22using CqtExpression = System.Data.Common.CommandTrees.DbExpression;
34protected override CqtExpression TypedTranslate(ExpressionConverter parent, MethodCallExpression linq)
325internal abstract CqtExpression Translate(ExpressionConverter parent, MethodCallExpression call);
379internal override CqtExpression Translate(ExpressionConverter parent, MethodCallExpression call)
432internal override DbExpression Translate(ExpressionConverter parent, MethodCallExpression call)
435CqtExpression queryExpression = parent.TranslateExpression(call.Object);
441CqtExpression arg = parent.TranslateExpression(call.Arguments[0]);
468internal override DbExpression Translate(ExpressionConverter parent, MethodCallExpression call)
488CqtExpression queryExpression = parent.TranslateExpression(inputQuery);
504internal override DbExpression Translate(ExpressionConverter parent, MethodCallExpression call)
510DbExpression queryExpression = parent.TranslateExpression(inputQuery);
521internal override CqtExpression Translate(ExpressionConverter parent, MethodCallExpression call)
599internal DbExpression TranslateFunctionCall(ExpressionConverter parent, MethodCallExpression call, EdmFunctionAttribute functionAttribute)
617DbExpression result = function.Invoke(arguments);
631private DbExpression NormalizeAllSetSources(ExpressionConverter parent, DbExpression argumentExpr)
633DbExpression newExpr = null;
641DbExpression normalizedExpr = NormalizeAllSetSources(parent, bindingExpr.Variable);
650List<KeyValuePair<string, DbExpression>> newColumns = new List<KeyValuePair<string, DbExpression>>();
661newColumns.Add(new KeyValuePair<string, DbExpression>(propertyExpr.Property.Name, newExpr));
665newColumns.Add(new KeyValuePair<string, DbExpression>(propertyExpr.Property.Name, propertyExpr));
728private DbExpression ValidateReturnType(DbExpression result, TypeUsage actualReturnType, ExpressionConverter parent, MethodCallExpression call, Type clrReturnType, bool isElementOfCollection)
857internal override CqtExpression Translate(ExpressionConverter parent, MethodCallExpression call)
889internal override CqtExpression Translate(ExpressionConverter parent, MethodCallExpression call)
891DbExpression argument = parent.TranslateExpression(call.Arguments[0]);
892DbExpression recreatedArgument;
945internal override DbExpression Translate(ExpressionConverter parent, MethodCallExpression call)
947DbExpression arg1 = parent.TranslateExpression(call.Arguments[0]);
948DbExpression arg2 = parent.TranslateExpression(call.Arguments[1]);
965internal override DbExpression Translate(ExpressionConverter parent, MethodCallExpression call)
989internal override CqtExpression Translate(ExpressionConverter parent, MethodCallExpression call)
996private static DbExpression CreateDefaultTranslation(ExpressionConverter parent, MethodCallExpression call, DbExpression patternExpression, DbExpression inputExpression)
1015internal override CqtExpression Translate(ExpressionConverter parent, MethodCallExpression call)
1020CqtExpression minusExpression = indexOfExpression.Minus(DbExpressionBuilder.Constant(1));
1041internal override CqtExpression Translate(ExpressionConverter parent, MethodCallExpression call)
1048private static DbExpression CreateDefaultTranslation(ExpressionConverter parent, MethodCallExpression call, DbExpression patternExpression, DbExpression inputExpression)
1050DbExpression indexOfExpression = parent.CreateCanonicalFunction(ExpressionConverter.IndexOf, call, patternExpression, inputExpression)
1072internal override CqtExpression Translate(ExpressionConverter parent, MethodCallExpression call)
1079private static DbExpression CreateDefaultTranslation(ExpressionConverter parent, MethodCallExpression call, DbExpression patternExpression, DbExpression inputExpression)
1084DbExpression indexOfExpression = parent.CreateCanonicalFunction(ExpressionConverter.IndexOf, call, reversePatternExpression, reverseInputExpression)
1104internal override CqtExpression Translate(ExpressionConverter parent, MethodCallExpression call)
1108DbExpression arg1 = parent.TranslateExpression(call.Arguments[0]);
1110DbExpression target = parent.TranslateExpression(call.Object);
1111DbExpression fromIndex = arg1.Plus(DbExpressionBuilder.Constant(1));
1113CqtExpression length;
1124CqtExpression substringExpression = parent.CreateCanonicalFunction(ExpressionConverter.Substring, call, target, fromIndex, length);
1143internal override CqtExpression Translate(ExpressionConverter parent, MethodCallExpression call)
1147DbExpression thisString = parent.TranslateExpression(call.Object);
1148DbExpression arg1 = parent.TranslateExpression(call.Arguments[0]);
1151CqtExpression result =
1161CqtExpression arg2 = parent.TranslateExpression(call.Arguments[1]);
1169CqtExpression substringStartIndex =
1173CqtExpression substringLength =
1178CqtExpression secondSubstring =
1190private static bool IsNonNegativeIntegerConstant(CqtExpression argument)
1222internal override CqtExpression Translate(ExpressionConverter parent, MethodCallExpression call)
1227DbExpression thisString = parent.TranslateExpression(call.Object);
1228DbExpression arg1 = parent.TranslateExpression(call.Arguments[0]);
1229CqtExpression firstSubstring =
1236CqtExpression secondSubstring =
1244DbExpression arg2 = parent.TranslateExpression(call.Arguments[1]);
1245CqtExpression result = parent.CreateCanonicalFunction(ExpressionConverter.Concat, call,
1265internal override CqtExpression Translate(ExpressionConverter parent, MethodCallExpression call)
1270DbExpression value = parent.TranslateExpression(call.Arguments[0]);
1271CqtExpression isNullExpression = value.IsNull();
1274CqtExpression emptyStringExpression =
1278CqtExpression result = isNullExpression.Or(emptyStringExpression);
1298internal override CqtExpression Translate(ExpressionConverter parent, MethodCallExpression call)
1302CqtExpression result = parent.TranslateExpression(call.Arguments[0]);
1325internal override CqtExpression Translate(ExpressionConverter parent, MethodCallExpression call)
1422internal override CqtExpression Translate(ExpressionConverter parent, MethodCallExpression call)
1456internal override CqtExpression Translate(ExpressionConverter parent, MethodCallExpression call)
1497internal override CqtExpression Translate(ExpressionConverter parent, MethodCallExpression call)
1513CqtExpression result = parent.TranslateIntoCanonicalFunction(intervalValue, call, call.Arguments[1]);
1526internal virtual CqtExpression Translate(ExpressionConverter parent, MethodCallExpression call, SequenceMethod sequenceMethod)
1530internal abstract CqtExpression Translate(ExpressionConverter parent, MethodCallExpression call);
1539protected override CqtExpression TranslateUnary(ExpressionConverter parent, CqtExpression operand, MethodCallExpression call)
1544CqtExpression count = parent.TranslateExpression(linqCount);
1547DbExpression result = TranslatePagingOperator(parent, operand, count);
1551protected abstract CqtExpression TranslatePagingOperator(ExpressionConverter parent, CqtExpression operand, CqtExpression count);
1556protected override CqtExpression TranslatePagingOperator(ExpressionConverter parent, CqtExpression operand, CqtExpression count)
1564protected override CqtExpression TranslatePagingOperator(ExpressionConverter parent, CqtExpression operand, CqtExpression count)
1572internal override CqtExpression Translate(ExpressionConverter parent, MethodCallExpression call)
1576CqtExpression outer = parent.TranslateSet(call.Arguments[0]);
1577CqtExpression inner = parent.TranslateSet(call.Arguments[1]);
1598CqtExpression outerKeySelector = selectorLambdaIsTrivialRename ?
1601CqtExpression innerKeySelector = selectorLambdaIsTrivialRename ?
1612var joinCondition = parent.CreateEqualsExpression(outerKeySelector, innerKeySelector, EqualsPattern.PositiveNullEqualityNonComposable, outerLambda.Body.Type, innerLambda.Body.Type);
1645CqtExpression selector = parent.TranslateExpression(selectorLambda.Body);
1659protected CqtExpression TranslateLeft(ExpressionConverter parent, LinqExpression expr)
1663protected virtual CqtExpression TranslateRight(ExpressionConverter parent, LinqExpression expr)
1667internal override CqtExpression Translate(ExpressionConverter parent, MethodCallExpression call)
1673CqtExpression left = this.TranslateLeft(parent, call.Object);
1674CqtExpression right = this.TranslateRight(parent, call.Arguments[0]);
1681CqtExpression left = this.TranslateLeft(parent, call.Arguments[0]);
1682CqtExpression right = this.TranslateRight(parent, call.Arguments[1]);
1686protected abstract CqtExpression TranslateBinary(ExpressionConverter parent, CqtExpression left, CqtExpression right);
1691protected override CqtExpression TranslateBinary(ExpressionConverter parent, CqtExpression left, CqtExpression right)
1699protected override CqtExpression TranslateBinary(ExpressionConverter parent, CqtExpression left, CqtExpression right)
1707protected override CqtExpression TranslateBinary(ExpressionConverter parent, CqtExpression left, CqtExpression right)
1715protected override CqtExpression TranslateBinary(ExpressionConverter parent, CqtExpression left, CqtExpression right)
1719protected override CqtExpression TranslateRight(ExpressionConverter parent, LinqExpression expr)
1725var result = base.TranslateRight(parent, expr);
1745internal override CqtExpression Translate(ExpressionConverter parent, MethodCallExpression call)
1750CqtExpression operand = parent.TranslateSet(call.Arguments[0]);
1756CqtExpression cqtLambda = parent.TranslateLambda(lambda, operand, out sourceBinding);
1774DbExpression unwrappedOperand = operand;
1777List<DbExpression> arguments = new List<DbExpression>(1);
1780DbExpression result = function.Invoke(arguments);
1795protected virtual CqtExpression WrapCollectionOperand(ExpressionConverter parent, CqtExpression operand,
1809protected virtual CqtExpression WrapNonCollectionOperand(ExpressionConverter parent, CqtExpression operand,
1978protected override CqtExpression WrapCollectionOperand(ExpressionConverter parent, CqtExpression operand, TypeUsage returnType)
1985protected override CqtExpression WrapNonCollectionOperand(ExpressionConverter parent, CqtExpression operand, TypeUsage returnType)
1988DbExpression constantExpression = DbExpressionBuilder.Constant(1);
2021internal override CqtExpression Translate(ExpressionConverter parent, MethodCallExpression call)
2027CqtExpression operand = parent.TranslateSet(call.Object);
2034CqtExpression operand = parent.TranslateSet(call.Arguments[0]);
2038protected abstract CqtExpression TranslateUnary(ExpressionConverter parent, CqtExpression operand, MethodCallExpression call);
2043protected override CqtExpression TranslateUnary(ExpressionConverter parent, CqtExpression operand, MethodCallExpression call)
2061protected override CqtExpression TranslateUnary(ExpressionConverter parent, CqtExpression operand,
2078CqtExpression ofTypeExpression = parent.OfType(operand, modelType);
2085protected override CqtExpression TranslateUnary(ExpressionConverter parent, CqtExpression operand,
2094protected override CqtExpression TranslateUnary(ExpressionConverter parent, CqtExpression operand,
2104internal override CqtExpression Translate(ExpressionConverter parent, MethodCallExpression call)
2106CqtExpression source;
2108CqtExpression lambda;
2113protected CqtExpression Translate(ExpressionConverter parent, MethodCallExpression call, out CqtExpression source, out DbExpressionBinding sourceBinding, out CqtExpression lambda)
2126protected abstract CqtExpression TranslateOneLambda(ExpressionConverter parent, DbExpressionBinding sourceBinding, CqtExpression lambda);
2131protected override CqtExpression TranslateOneLambda(ExpressionConverter parent, DbExpressionBinding sourceBinding, CqtExpression lambda)
2139protected override CqtExpression TranslateOneLambda(ExpressionConverter parent, DbExpressionBinding sourceBinding, CqtExpression lambda)
2147protected override CqtExpression TranslateOneLambda(ExpressionConverter parent, DbExpressionBinding sourceBinding, CqtExpression lambda)
2155internal override CqtExpression Translate(ExpressionConverter parent, MethodCallExpression call)
2157CqtExpression source;
2159CqtExpression lambda;
2160CqtExpression result = Translate(parent, call, out source, out sourceBinding, out lambda);
2164protected override CqtExpression TranslateOneLambda(ExpressionConverter parent, DbExpressionBinding sourceBinding, CqtExpression lambda)
2175internal override DbExpression Translate(ExpressionConverter parent, MethodCallExpression call)
2177DbExpression operand = parent.TranslateSet(call.Arguments[0]);
2180DbExpression defaultValue = call.Arguments.Count == 2 ?
2184DbExpression left = DbExpressionBuilder.NewCollection(new DbExpression[] { 1 });
2192operand = o.Project(new Row(((DbExpression)1).As("sentinel"), o.Variable.As("value")));
2196DbExpression join = DbExpressionBuilder.LeftOuterJoin(leftBinding, rightBinding, true);
2198DbExpression projection = joinBinding.Variable.Property(rightBinding.VariableName);
2206DbExpression spannedProjection = joinBinding.Project(projection);
2211private static DbExpression GetDefaultValue(ExpressionConverter parent, Type resultType)
2215DbExpression result = null == defaultValue ?
2227internal override DbExpression Translate(ExpressionConverter parent, MethodCallExpression call)
2231private static DbExpression TranslateContainsHelper(ExpressionConverter parent, CqtExpression left, IEnumerable<DbExpression> rightList, EqualsPattern pattern, Type leftType, Type rightType)
2235var expressions = new List<DbExpression>(predicates);
2236var cqt = System.Data.Common.Utils.Helpers.BuildBalancedTreeInPlace(expressions,
2241internal static DbExpression TranslateContains(ExpressionConverter parent, Expression sourceExpression, Expression valueExpression)
2243DbExpression source = parent.NormalizeSetSource(parent.TranslateExpression(sourceExpression));
2244DbExpression value = parent.TranslateExpression(valueExpression);
2249IList<DbExpression> arguments = ((DbNewInstanceExpression)source).Arguments;
2259IEnumerable<DbExpression> constantArguments = arguments.Where(argument => argument.ExpressionKind == DbExpressionKind.Constant);
2260CqtExpression constantCqt = null;
2267IEnumerable<DbExpression> otherArguments = arguments.Where(argument => argument.ExpressionKind != DbExpressionKind.Constant);
2268CqtExpression otherCqt = null;
2293protected virtual CqtExpression LimitResult(ExpressionConverter parent, CqtExpression expression)
2298protected override CqtExpression TranslateUnary(ExpressionConverter parent, CqtExpression operand, MethodCallExpression call)
2300CqtExpression result = LimitResult(parent, operand);
2322internal static CqtExpression AddDefaultCase(ExpressionConverter parent, CqtExpression element, Type elementType)
2335List<CqtExpression> whenExpressions = new List<CqtExpression>(1);
2338List<CqtExpression> thenExpressions = new List<CqtExpression>(1);
2348protected override CqtExpression TranslateUnary(ExpressionConverter parent, CqtExpression operand, MethodCallExpression call)
2365protected override CqtExpression TranslateUnary(ExpressionConverter parent, CqtExpression operand, MethodCallExpression call)
2374protected override CqtExpression LimitResult(ExpressionConverter parent, CqtExpression expression)
2395protected virtual CqtExpression RestrictResult(ExpressionConverter parent, CqtExpression expression)
2401internal override CqtExpression Translate(ExpressionConverter parent, MethodCallExpression call)
2404CqtExpression input = base.Translate(parent, call);
2417CqtExpression element = input.Element();
2431protected override CqtExpression TranslateOneLambda(ExpressionConverter parent, DbExpressionBinding sourceBinding, CqtExpression lambda)
2441internal override CqtExpression Translate(ExpressionConverter parent, MethodCallExpression call)
2458internal override CqtExpression Translate(ExpressionConverter parent, MethodCallExpression call)
2465protected override CqtExpression RestrictResult(ExpressionConverter parent, CqtExpression expression)
2485internal override CqtExpression Translate(ExpressionConverter parent, MethodCallExpression call)
2495CqtExpression apply = base.Translate(parent, call);
2560CqtExpression projectRight = applyBinding.Variable.Property(applyRowType.Properties[1]);
2562CqtExpression resultProjection;
2565CqtExpression projectLeft = applyBinding.Variable.Property(applyRowType.Properties[0]);
2587private static bool IsLeftOuterJoin(CqtExpression cqtExpression, out DbExpressionBinding crossApplyInput, out EdmProperty lojRightInput)
2703protected override CqtExpression TranslateOneLambda(ExpressionConverter parent, DbExpressionBinding sourceBinding, CqtExpression lambda)
2715internal override CqtExpression Translate(ExpressionConverter parent, MethodCallExpression call)
2718CqtExpression source = parent.TranslateSet(call.Arguments[0]);
2727CqtExpression cast = parent.CreateCastExpression(binding.Variable, toClrType, fromClrType);
2741internal override CqtExpression Translate(ExpressionConverter parent, MethodCallExpression call, SequenceMethod sequenceMethod)
2744CqtExpression source = parent.TranslateSet(call.Arguments[0]);
2749CqtExpression keySelector = parent.TranslateLambda(keySelectorLinq, source, out sourceGroupBinding);
2759List<KeyValuePair<string, DbExpression>> keys = new List<KeyValuePair<string, DbExpression>>();
2761keys.Add(new KeyValuePair<string, CqtExpression>(KeyColumnName, keySelector));
2764DbExpression groupBy = sourceGroupBinding.GroupBy(keys, aggregates);
2768CqtExpression selection = groupByBinding.Variable.Property(GroupColumnName);
2778CqtExpression elementSelector = parent.TranslateLambda(elementSelectorLinq, selection, out elementSelectorSourceBinding);
2783CqtExpression[] projectionTerms = new CqtExpression[2];
2796CqtExpression topLevelProject = groupByBinding.Project(DbExpressionBuilder.New(rowTypeUsage, projectionTerms));
2798var result = topLevelProject;
2806private static DbExpression ProcessResultSelector(ExpressionConverter parent, MethodCallExpression call, SequenceMethod sequenceMethod, CqtExpression topLevelProject, DbExpression result)
2829CqtExpression resultSelector = parent.TranslateExpression(
2838internal override DbExpression Translate(ExpressionConverter parent, MethodCallExpression call)
2850internal override CqtExpression Translate(ExpressionConverter parent, MethodCallExpression call)
2860CqtExpression outer = parent.TranslateSet(call.Arguments[0]);
2861CqtExpression inner = parent.TranslateSet(call.Arguments[1]);
2868CqtExpression outerSelector = parent.TranslateLambda(
2870CqtExpression innerSelector = parent.TranslateLambda(
2879CqtExpression nestedCollection = parent.Filter(innerBinding,
2885List<KeyValuePair<string, CqtExpression>> recordColumns = new List<KeyValuePair<string, CqtExpression>>(2);
2886recordColumns.Add(new KeyValuePair<string, CqtExpression>(outerColumn, outerBinding.Variable));
2887recordColumns.Add(new KeyValuePair<string, CqtExpression>(innerColumn, nestedCollection));
2888CqtExpression joinProjection = DbExpressionBuilder.NewRow(recordColumns);
2889CqtExpression joinProject = outerBinding.Project(joinProjection);
2894CqtExpression outerProperty = joinProjectBinding.Variable.Property(outerColumn);
2895CqtExpression innerProperty = joinProjectBinding.Variable.Property(innerColumn);
2903CqtExpression selectorProject = parent.TranslateExpression(linqSelector.Body);
2910CqtExpression selector = joinProjectBinding.Project(selectorProject);
2916private CqtExpression CollapseTrivialRenamingProjection(CqtExpression cqtExpression)
2966var newProjectionArguments = new List<CqtExpression>();
2985protected override CqtExpression TranslateOneLambda(ExpressionConverter parent, DbExpressionBinding sourceBinding, CqtExpression lambda)
3012internal override CqtExpression Translate(ExpressionConverter parent, MethodCallExpression call)
3015CqtExpression source = parent.TranslateSet(call.Arguments[0]);
3031CqtExpression lambda = parent.TranslateExpression(lambdaExpression.Body);
System\Data\Objects\ELinq\OrderByLifter.cs (114)
43internal DbExpression Project(DbExpressionBinding input, DbExpression projection)
49internal DbExpression Filter(DbExpressionBinding input, DbExpression predicate)
55internal DbExpression OfType(DbExpression argument, TypeUsage type)
61internal DbExpression Skip(DbExpressionBinding input, DbExpression skipCount)
67internal DbExpression Limit(DbExpression argument, DbExpression limit)
74private OrderByLifterBase GetLifter(DbExpression root)
81protected readonly DbExpression _root;
84protected OrderByLifterBase(DbExpression root, AliasGenerator aliasGenerator)
100internal static OrderByLifterBase GetLifter(DbExpression source, AliasGenerator aliasGenerator)
109DbExpression projectInput = project.Input.Expression;
121DbExpression limitInput = limit.Argument;
139DbExpression limitInput = limit.Argument;
151DbExpression projectInput = project.Input.Expression;
170internal abstract DbExpression Project(DbProjectExpression project);
171internal abstract DbExpression Filter(DbFilterExpression filter);
172internal virtual DbExpression OfType(TypeUsage type)
176DbExpression filter = this.Filter(rootBinding.Filter(rootBinding.Variable.IsOf(type)));
179DbExpression project = filterLifter.Project(filterBinding.Project(filterBinding.Variable.TreatAs(type)));
182internal abstract DbExpression Limit(DbExpression k);
183internal abstract DbExpression Skip(DbExpression k);
187protected DbProjectExpression ComposeProject(DbExpression input, DbProjectExpression first, DbProjectExpression second)
200protected DbFilterExpression ComposeFilter(DbExpression input, DbProjectExpression first, DbFilterExpression second)
215protected DbSkipExpression AddToSkip(DbExpression input, DbSkipExpression skip, DbExpression plusK)
218DbExpression newCount = CombineIntegers(skip.Count, plusK,
223protected DbLimitExpression SubtractFromLimit(DbExpression input, DbLimitExpression limit, DbExpression minusK)
225DbExpression newCount = CombineIntegers(limit.Limit, minusK,
230protected DbLimitExpression MinimumLimit(DbExpression input, DbLimitExpression limit, DbExpression k)
233DbExpression newCount = CombineIntegers(limit.Limit, k, Math.Min);
237protected DbExpression CombineIntegers(DbExpression left, DbExpression right,
256protected DbProjectExpression RebindProject(DbExpression input, DbProjectExpression project)
262protected DbFilterExpression RebindFilter(DbExpression input, DbFilterExpression filter)
268protected DbSortExpression RebindSort(DbExpression input, DbSortExpression sort)
274protected DbSortExpression ApplySkipOrderToSort(DbExpression input, DbSkipExpression sortSpec)
280protected DbSkipExpression ApplySortOrderToSkip(DbExpression input, DbSortExpression sort, DbExpression k)
286protected DbSkipExpression RebindSkip(DbExpression input, DbSkipExpression skip, DbExpression k)
301private readonly DbExpression _source;
311internal override DbExpression Filter(DbFilterExpression filter)
318internal override DbExpression Project(DbProjectExpression project)
324internal override DbExpression Limit(DbExpression k)
340internal override DbExpression Skip(DbExpression k)
355private readonly DbExpression _source;
365internal override DbExpression Filter(DbFilterExpression filter)
371internal override DbExpression Project(DbProjectExpression project)
377internal override DbExpression Limit(DbExpression k)
392internal override DbExpression Skip(DbExpression k)
412private readonly DbExpression _source;
423internal override DbExpression Filter(DbFilterExpression filter)
437internal override DbExpression Project(DbProjectExpression project)
447internal override DbExpression Limit(DbExpression k)
471internal override DbExpression Skip(DbExpression k)
512private readonly DbExpression _source;
523internal override DbExpression Filter(DbFilterExpression filter)
536internal override DbExpression Project(DbProjectExpression project)
545internal override DbExpression Limit(DbExpression k)
568internal override DbExpression Skip(DbExpression k)
587private readonly DbExpression _source;
597internal override DbExpression Filter(DbFilterExpression filter)
607internal override DbExpression Limit(DbExpression k)
613internal override DbExpression Project(DbProjectExpression project)
619internal override DbExpression Skip(DbExpression k)
641private readonly DbExpression _source;
650internal override DbExpression Filter(DbFilterExpression filter)
656internal override DbExpression Project(DbProjectExpression project)
662internal override DbExpression Limit(DbExpression k)
668internal override DbExpression Skip(DbExpression k)
691private readonly DbExpression _source;
701internal override DbExpression Project(DbProjectExpression project)
707internal override DbExpression Filter(DbFilterExpression filter)
717internal override DbExpression Limit(DbExpression k)
723internal override DbExpression Skip(DbExpression k)
736private readonly DbExpression _source;
745internal override DbExpression Project(DbProjectExpression project)
751internal override DbExpression Filter(DbFilterExpression filter)
757internal override DbExpression Limit(DbExpression k)
763internal override DbExpression Skip(DbExpression k)
775internal PassthroughOrderByLifter(DbExpression source, AliasGenerator aliasGenerator)
780internal override DbExpression Project(DbProjectExpression project)
785internal override DbExpression Filter(DbFilterExpression filter)
790internal override DbExpression OfType(TypeUsage type)
795internal override DbExpression Limit(DbExpression k)
800internal override DbExpression Skip(DbExpression k)
System\Data\Objects\ELinq\Translator.cs (137)
37internal abstract DbExpression Translate(ExpressionConverter parent, Expression linq);
51internal override DbExpression Translate(ExpressionConverter parent, Expression linq)
55protected abstract DbExpression TypedTranslate(ExpressionConverter parent, T_Linq linq);
62protected override DbExpression TypedTranslate(ExpressionConverter parent, ConstantExpression linq)
161protected override DbExpression TypedTranslate(ExpressionConverter parent, MemberExpression linq)
163DbExpression propertyExpression;
172DbExpression instance = parent.TranslateExpression(linq.Expression);
284MemberInfo clrMember, TypeUsage definingType, DbExpression instance, out DbExpression propertyExpression)
353private static DbExpression TranslateNavigationProperty(ExpressionConverter parent, MemberInfo clrMember, DbExpression instance, NavigationProperty navProp)
355DbExpression propertyExpression;
368List<KeyValuePair<string, DbExpression>> collectionColumns =
369new List<KeyValuePair<string, DbExpression>>(2);
370collectionColumns.Add(new KeyValuePair<string, DbExpression>(
372collectionColumns.Add(new KeyValuePair<string, DbExpression>(
381private static DbExpression TranslateCount(ExpressionConverter parent, Type sequenceElementType, Expression sequence)
446internal override DbExpression Translate(ExpressionConverter parent, MemberExpression call)
523internal abstract DbExpression Translate(ExpressionConverter parent, MemberExpression call);
558internal override DbExpression Translate(ExpressionConverter parent, MemberExpression call)
595internal override DbExpression Translate(ExpressionConverter parent, MemberExpression call)
599DbExpression result;
626internal override DbExpression Translate(ExpressionConverter parent, MemberExpression call)
644internal override DbExpression Translate(ExpressionConverter parent, MemberExpression call)
664internal override DbExpression Translate(ExpressionConverter parent, MemberExpression call)
666DbExpression argument = parent.TranslateExpression(call.Expression);
684internal override DbExpression Translate(ExpressionConverter parent, MemberExpression call)
686DbExpression argument = parent.TranslateExpression(call.Expression);
698protected override DbExpression TypedTranslate(ExpressionConverter parent, ParameterExpression linq)
709protected override DbExpression TypedTranslate(ExpressionConverter parent, NewExpression linq)
721List<KeyValuePair<String, DbExpression>> recordColumns =
722new List<KeyValuePair<string, DbExpression>>(memberCount + 1);
730DbExpression memberValue = parent.TranslateExpression(linq.Arguments[i]);
732recordColumns.Add(new KeyValuePair<string, DbExpression>(memberName, memberValue));
760protected override DbExpression TypedTranslate(ExpressionConverter parent, NewArrayExpression linq)
793protected override DbExpression TypedTranslate(ExpressionConverter parent, ListInitExpression linq)
814protected override DbExpression TypedTranslate(ExpressionConverter parent, MemberInitExpression linq)
824List<KeyValuePair<String, DbExpression>> recordColumns =
825new List<KeyValuePair<string, DbExpression>>(linq.Bindings.Count + 1);
840DbExpression memberValue = parent.TranslateExpression(binding.Expression);
843recordColumns.Add(new KeyValuePair<string, DbExpression>(memberName, memberValue));
870protected override DbExpression TypedTranslate(ExpressionConverter parent, ConditionalExpression linq)
873List<DbExpression> whenExpressions = new List<DbExpression>(1);
875List<DbExpression> thenExpressions = new List<DbExpression>(1);
877DbExpression elseExpression = parent.TranslateExpression(linq.IfFalse);
887internal override DbExpression Translate(ExpressionConverter parent, Expression linq)
898internal override DbExpression Translate(ExpressionConverter parent, Expression linq)
918protected override DbExpression TypedTranslate(ExpressionConverter parent, System.Linq.Expressions.BinaryExpression linq)
922protected abstract DbExpression TranslateBinary(ExpressionConverter parent, DbExpression left, DbExpression right, BinaryExpression linq);
928protected override DbExpression TranslateBinary(ExpressionConverter parent, DbExpression left, DbExpression right, BinaryExpression linq)
934DbExpression isNull = parent.CreateIsNullExpression(left, linq.Left.Type);
937List<DbExpression> whenExpressions = new List<DbExpression>(1);
939List<DbExpression> thenExpressions = new List<DbExpression>(1);
941DbExpression caseExpression = DbExpressionBuilder.Case(whenExpressions,
951protected override DbExpression TranslateBinary(ExpressionConverter parent, DbExpression left, DbExpression right, BinaryExpression linq)
960protected override DbExpression TranslateBinary(ExpressionConverter parent, DbExpression left, DbExpression right, BinaryExpression linq)
969protected override DbExpression TranslateBinary(ExpressionConverter parent, DbExpression left, DbExpression right, BinaryExpression linq)
978protected override DbExpression TranslateBinary(ExpressionConverter parent, DbExpression left, DbExpression right, BinaryExpression linq)
987protected override DbExpression TranslateBinary(ExpressionConverter parent, DbExpression left, DbExpression right, BinaryExpression linq)
996protected override DbExpression TranslateBinary(ExpressionConverter parent, DbExpression left, DbExpression right, BinaryExpression linq)
1005protected override DbExpression TypedTranslate(ExpressionConverter parent, System.Linq.Expressions.BinaryExpression linq)
1021DbExpression cqtLeft = parent.TranslateExpression(linqLeft);
1022DbExpression cqtRight = parent.TranslateExpression(linqRight);
1030private static DbExpression CreateIsNullExpression(ExpressionConverter parent, Expression input)
1035DbExpression inputCqt = parent.TranslateExpression(input);
1064protected override DbExpression TypedTranslate(ExpressionConverter parent, System.Linq.Expressions.BinaryExpression linq)
1079protected override DbExpression TypedTranslate(ExpressionConverter parent, TypeBinaryExpression linq)
1081DbExpression operand = parent.TranslateExpression(linq.Expression);
1094protected override DbExpression TranslateBinary(ExpressionConverter parent, DbExpression left, DbExpression right, BinaryExpression linq)
1112protected override DbExpression TranslateBinary(ExpressionConverter parent, DbExpression left, DbExpression right, BinaryExpression linq)
1121protected override DbExpression TranslateBinary(ExpressionConverter parent, DbExpression left, DbExpression right, BinaryExpression linq)
1130protected override DbExpression TranslateBinary(ExpressionConverter parent, DbExpression left, DbExpression right, BinaryExpression linq)
1139protected override DbExpression TranslateBinary(ExpressionConverter parent, DbExpression left, DbExpression right, BinaryExpression linq)
1148protected override DbExpression TranslateUnary(ExpressionConverter parent, System.Linq.Expressions.UnaryExpression unary, DbExpression operand)
1157protected override DbExpression TranslateUnary(ExpressionConverter parent, UnaryExpression unary, DbExpression operand)
1176protected override DbExpression TypedTranslate(ExpressionConverter parent, System.Linq.Expressions.BinaryExpression linq)
1178DbExpression left = parent.TranslateExpression(linq.Left);
1179DbExpression right = parent.TranslateExpression(linq.Right);
1190protected abstract DbExpression TranslateIntoLogicExpression(ExpressionConverter parent, System.Linq.Expressions.BinaryExpression linq, DbExpression left, DbExpression right);
1196protected override DbExpression TranslateIntoLogicExpression(ExpressionConverter parent, System.Linq.Expressions.BinaryExpression linq, DbExpression left, DbExpression right)
1205protected override DbExpression TranslateIntoLogicExpression(ExpressionConverter parent, System.Linq.Expressions.BinaryExpression linq, DbExpression left, DbExpression right)
1214protected override DbExpression TranslateIntoLogicExpression(ExpressionConverter parent, System.Linq.Expressions.BinaryExpression linq, DbExpression left, DbExpression right)
1217DbExpression firstExpression = left.And(right.Not());
1218DbExpression secondExpression = left.Not().And(right);
1219DbExpression result = firstExpression.Or(secondExpression);
1227protected override DbExpression TypedTranslate(ExpressionConverter parent, System.Linq.Expressions.UnaryExpression linq)
1229DbExpression operand = parent.TranslateExpression(linq.Operand);
1245protected override DbExpression TypedTranslate(ExpressionConverter parent, System.Linq.Expressions.UnaryExpression linq)
1249protected abstract DbExpression TranslateUnary(ExpressionConverter parent, System.Linq.Expressions.UnaryExpression unary, DbExpression operand);
1255protected override DbExpression TranslateUnary(ExpressionConverter parent, System.Linq.Expressions.UnaryExpression unary, DbExpression operand)
1266protected override DbExpression TranslateUnary(ExpressionConverter parent, System.Linq.Expressions.UnaryExpression unary, DbExpression operand)
1270DbExpression cast = parent.CreateCastExpression(operand, toClrType, fromClrType);
1278protected override DbExpression TranslateUnary(ExpressionConverter parent, System.Linq.Expressions.UnaryExpression unary, DbExpression operand)
System\Data\Objects\Internal\ObjectSpanRewriter.cs (70)
38private DbExpression _toRewrite;
48internal static bool TryRewrite(DbQueryCommandTree tree, Span span, MergeOption mergeOption, AliasGenerator aliasGenerator, out DbExpression newQuery, out SpanIndex spanInfo)
86/// <param name="toRewrite">A <see cref="DbExpression"/> representing the query to span.</param>
87internal ObjectSpanRewriter(DbCommandTree tree, DbExpression toRewrite, AliasGenerator aliasGenerator)
104internal DbExpression Query { get { return _toRewrite; } }
123internal DbExpression RewriteQuery()
125DbExpression retExpr = Rewrite(_toRewrite);
142public List<KeyValuePair<string, DbExpression>> ColumnDefinitions;
151info.ColumnDefinitions = new List<KeyValuePair<string, DbExpression>>();
162internal virtual SpanTrackingInfo CreateEntitySpanTrackingInfo(DbExpression expression, EntityType entityType) { return new SpanTrackingInfo(); }
164protected DbExpression Rewrite(DbExpression expression)
215private DbExpression RewriteEntity(DbExpression expression, EntityType entityType)
263DbExpression columnDef = null;
268DbExpression navSource = expression.GetEntityRef();
273new KeyValuePair<string, DbExpression>(
297new KeyValuePair<string, DbExpression>(
304DbExpression spannedExpression = DbExpressionBuilder.NewRow(tracking.ColumnDefinitions);
314private DbExpression RewriteElementExpression(DbElementExpression expression)
316DbExpression rewrittenInput = Rewrite(expression.Argument);
324private DbExpression RewriteLimitExpression(DbLimitExpression expression)
326DbExpression rewrittenInput = Rewrite(expression.Argument);
336private DbExpression RewriteRow(DbExpression expression, RowType rowType)
355Dictionary<int, DbExpression> unmodifiedColumns = null;
356Dictionary<int, DbExpression> spannedColumns = null;
363DbExpression columnExpr = null;
376DbExpression spannedColumn = this.Rewrite(columnExpr);
382spannedColumns = new Dictionary<int, DbExpression>();
392unmodifiedColumns = new Dictionary<int, DbExpression>();
408List<DbExpression> columnArguments = new List<DbExpression>(rowType.Properties.Count);
413DbExpression columnDef = null;
428DbExpression rewritten = rewrittenRowTypeUsage.New(columnArguments);
437DbExpression condition = DbExpressionBuilder.CreateIsNullExpressionAllowingRowTypeArgument(expression);
438DbExpression nullExpression = DbExpressionBuilder.Null(rewrittenRowTypeUsage);
440new List<DbExpression>(new DbExpression[] { condition }),
441new List<DbExpression>(new DbExpression[] { nullExpression }),
457private DbExpression RewriteCollection(DbExpression expression, CollectionType collectionType)
459DbExpression target = expression;
494DbExpression result = expression;
497DbExpression newProjection = this.Rewrite(project.Projection);
508DbExpression projection = collectionBinding.Variable;
510DbExpression spannedProjection = this.Rewrite(projection);
534List<DbExpression> args = new List<DbExpression>(1);
559private bool TryGetNavigationSource(AssociationEndMember wasSourceNowTargetEnd, out DbExpression source)
717private DbExpression _source;
734public DbExpression Source { get { return _source; } }
740internal static DbExpression FindNavigationExpression(DbExpression expression, AliasGenerator aliasGenerator, out NavigationInfo navInfo)
753DbExpression rewrittenExpression = visitor.Find(expression);
775private DbExpression Find(DbExpression expression)
780protected override DbExpression VisitExpression(DbExpression expression)
799public override DbExpression Visit(DbRelationshipNavigationExpression expression)
814public override DbExpression Visit(DbFilterExpression expression)
817DbExpression found = Find(expression.Input.Expression);
828public override DbExpression Visit(DbProjectExpression expression)
833DbExpression testExpr = expression.Projection;
844DbExpression found = Find(expression.Input.Expression);
855public override DbExpression Visit(DbSortExpression expression)
857DbExpression found = Find(expression.Input.Expression);
868public override DbExpression Visit(DbSkipExpression expression)
870DbExpression found = Find(expression.Input.Expression);
System\Data\Query\PlanCompiler\CTreeGenerator.cs (147)
40internal class CTreeGenerator : BasicOpVisitorOfT<DbExpression>
167internal abstract bool TryResolveVar(Var targetVar, out DbExpression resultExpr);
190internal override bool TryResolveVar(Var targetVar, out DbExpression resultExpr)
218internal RelOpInfo(string bindingName, DbExpression publisher, IEnumerable<VarInfo> publishedVars)
236internal DbExpression Publisher { get { return _binding.Expression; } }
290private Dictionary<Var, DbExpression> _definedVars;
292internal VarDefScope(Dictionary<Var, DbExpression> definedVars)
303internal override bool TryResolveVar(Var targetVar, out DbExpression resultExpr)
306DbExpression foundExpr = null;
326private Dictionary<DbExpression, RelOpInfo> _relOpState = new Dictionary<DbExpression, RelOpInfo>();
358DbExpression queryExpression = VisitNode(toConvert);
369private void AssertRelOp(DbExpression expr)
382private RelOpInfo PublishRelOp(string name, DbExpression expr, VarInfoList publishedVars)
394private RelOpInfo ConsumeRelOp(DbExpression expr)
412DbExpression inputExpr = VisitNode(inputNode);
517Dictionary<Var, DbExpression> varDefs = new Dictionary<Var, DbExpression>();
579private DbExpression ResolveVar(Var referencedVar)
581DbExpression retExpr = null;
622DbExpression foundExpr = null;
650private DbExpression VisitChild(Node n, int index)
656private new List<DbExpression> VisitChildren(Node n)
658List<DbExpression> retList = new List<DbExpression>();
672protected override DbExpression VisitConstantOp(ConstantBaseOp op, Node n)
680public override DbExpression Visit(ConstantOp op, Node n)
685public override DbExpression Visit(InternalConstantOp op, Node n)
690public override DbExpression Visit(NullOp op, Node n)
695public override DbExpression Visit(NullSentinelOp op, Node n)
700public override DbExpression Visit(ConstantPredicateOp op, Node n)
709public override DbExpression Visit(FunctionOp op, Node n)
718public override DbExpression Visit(PropertyOp op, Node n)
724public override DbExpression Visit(RelPropertyOp op, Node n)
730public override DbExpression Visit(ArithmeticOp op, Node n)
735DbExpression resultExpr = null;
745DbExpression left = VisitChild(n, 0);
746DbExpression right = VisitChild(n, 1);
793public override DbExpression Visit(CaseOp op, Node n)
809List<DbExpression> whens = new List<DbExpression>();
810List<DbExpression> thens = new List<DbExpression>();
811DbExpression elseExpr = null;
838public override DbExpression Visit(ComparisonOp op, Node n)
846DbExpression left = VisitChild(n, 0);
847DbExpression right = VisitChild(n, 1);
849DbExpression compExpr = null;
901public override DbExpression Visit(ConditionalOp op, Node n)
909DbExpression left = VisitChild(n, 0);
910DbExpression condExpr = null;
960public override DbExpression Visit(LikeOp op, Node n)
974public override DbExpression Visit(AggregateOp op, Node n)
983public override DbExpression Visit(NavigateOp op, Node n)
989public override DbExpression Visit(NewEntityOp op, Node n)
994public override DbExpression Visit(NewInstanceOp op, Node n)
1000public override DbExpression Visit(DiscriminatedNewEntityOp op, Node n)
1006public override DbExpression Visit(NewMultisetOp op, Node n)
1012public override DbExpression Visit(NewRecordOp op, Node n)
1018public override DbExpression Visit(RefOp op, Node n)
1024public override DbExpression Visit(VarRefOp op, Node n)
1029public override DbExpression Visit(TreatOp op, Node n)
1035public override DbExpression Visit(CastOp op, Node n)
1048public override DbExpression Visit(SoftCastOp op, Node n)
1059public override DbExpression Visit(IsOfOp op, Node n)
1068public override DbExpression Visit(ExistsOp op, Node n)
1073DbExpression inputExpr = VisitNode(n.Child0);
1087public override DbExpression Visit(ElementOp op, Node n)
1090DbExpression inputExpr = VisitNode(n.Child0);
1098public override DbExpression Visit(GetRefKeyOp op, Node n)
1104public override DbExpression Visit(GetEntityRefOp op, Node n)
1110public override DbExpression Visit(CollectOp op, Node n)
1191private DbExpression CreateProject(RelOpInfo sourceInfo, IEnumerable<Var> outputVars)
1206List<KeyValuePair<string, DbExpression>> projectedCols = new List<KeyValuePair<string, DbExpression>>();
1214DbExpression columnValue = ResolveVar(projectedVar);
1215projectedCols.Add(new KeyValuePair<string, DbExpression>(columnName, columnValue));
1227DbExpression retExpr = sourceInfo.CreateBinding().Project(DbExpressionBuilder.NewRow(projectedCols));
1273public override DbExpression Visit(ScanTableOp op, Node n)
1294DbExpression retExpr = op.Table.TableMetadata.Extent.Scan();
1308public override DbExpression Visit(ScanViewOp op, Node n)
1318public override DbExpression Visit(UnnestOp op, Node n)
1329DbExpression expr = input.Op.Accept(this, input);
1370DbExpression constExpr = DbExpressionBuilder.Constant(1);
1371List<KeyValuePair<string, DbExpression>> projectedCols = new List<KeyValuePair<string, DbExpression>>();
1372projectedCols.Add(new KeyValuePair<string, DbExpression>("C0", constExpr));
1374DbExpression retExpr = sourceInfo.CreateBinding().Project(DbExpressionBuilder.NewRow(projectedCols));
1403DbExpression retExpr = null;
1441DbExpression VisitProject(ProjectOp op, Node n, IEnumerable<Var> varList)
1461DbExpression retExpr = CreateProject(sourceInfo, varList);
1475public override DbExpression Visit(ProjectOp op, Node n)
1480public override DbExpression Visit(FilterOp op, Node n)
1490DbExpression predicateExpr = VisitNode(n.Child1);
1499DbExpression retExpr = inputInfo.CreateBinding().Filter(predicateExpr);
1535DbExpression keyExpression = ResolveVar(sortKey.Var);
1552public override DbExpression Visit(SortOp op, Node n)
1563DbExpression retExpr = inputInfo.CreateBinding().Sort(VisitSortKeys(op.Keys));
1579private DbExpression CreateLimitExpression(DbExpression argument, DbExpression limit, bool withTies)
1585public override DbExpression Visit(ConstrainedSortOp op, Node n)
1587DbExpression retExpr = null;
1601DbExpression inputExpr = this.VisitNode(n.Child0);
1666public override DbExpression Visit(GroupByOp op, Node n)
1690List<KeyValuePair<string, DbExpression>> keyExprs = new List<KeyValuePair<string, DbExpression>>();
1700keyExprs.Add(new KeyValuePair<string, DbExpression>(keyColName, ResolveVar(keyVar)));
1747DbExpression aggDef = VisitNode(aggOpNode.Child0);
1805DbExpression retExpr = inputInfo.Binding.GroupBy(keyExprs, aggregates);
1812public override DbExpression Visit(GroupByIntoOp op, Node n)
1865private DbExpression VisitBinaryJoin(Node joinNode, DbExpressionKind joinKind)
1882DbExpression joinCond = null;
1904DbExpression retExpr = DbExpressionBuilder.CreateJoinExpressionByKind(
1945public override DbExpression Visit(CrossJoinOp op, Node n)
1973DbExpression retExpr = DbExpressionBuilder.CrossJoin(inputBindings);
1983public override DbExpression Visit(InnerJoinOp op, Node n)
1989public override DbExpression Visit(LeftOuterJoinOp op, Node n)
1995public override DbExpression Visit(FullOuterJoinOp op, Node n)
2011private DbExpression VisitApply(Node applyNode, DbExpressionKind applyKind)
2023DbExpression retExpr = DbExpressionBuilder.CreateApplyExpressionByKind(
2058public override DbExpression Visit(CrossApplyOp op, Node n)
2064public override DbExpression Visit(OuterApplyOp op, Node n)
2095private DbExpression VisitSetOpArgument(Node argNode, VarVec outputVars, VarMap argVars)
2138private DbExpression VisitSetOp(SetOp op, Node n, AliasGenerator alias, Func<DbExpression, DbExpression, DbExpression> setOpExpressionBuilder)
2148DbExpression left = VisitSetOpArgument(n.Child0, op.Outputs, op.VarMap[0]);
2149DbExpression right = VisitSetOpArgument(n.Child1, op.Outputs, op.VarMap[1]);
2188DbExpression retExpr = setOpExpressionBuilder(left, right);
2194public override DbExpression Visit(UnionAllOp op, Node n)
2199public override DbExpression Visit(IntersectOp op, Node n)
2204public override DbExpression Visit(ExceptOp op, Node n)
2210public override DbExpression Visit(DerefOp op, Node n)
2215public override DbExpression Visit(DistinctOp op, Node n)
2226DbExpression distinctExpr = sourceInfo.Publisher.Distinct();
2246public override DbExpression Visit(SingleRowOp op, Node n)
2249DbExpression inputExpr;
2278List<DbExpression> collectionElements = new List<DbExpression>();
2293public override DbExpression Visit(SingleRowTableOp op, Node n)
2303public override DbExpression Visit(VarDefOp op, Node n)
2313public override DbExpression Visit(VarDefListOp op, Node n)
2338public override DbExpression Visit(PhysicalProjectOp op, Node n)
2364public override DbExpression Visit(SingleStreamNestOp op, Node n)
2368public override DbExpression Visit(MultiStreamNestOp op, Node n)
System\Data\Query\PlanCompiler\ITreeGenerator.cs (42)
203private readonly Dictionary<DbExpression, bool> _functionsIsPredicateFlag = new Dictionary<DbExpression, bool>();
359private bool IsPredicate(DbExpression expr)
440private delegate Node VisitExprDelegate(DbExpression e);
442private Node VisitExpr(DbExpression e)
459private Node VisitExprAsScalar(DbExpression expr)
477private Node ConvertToScalarOpTree(Node node, DbExpression expr)
525private Node ConvertPredicateToScalarOpTree(Node node, DbExpression expr)
563private Node VisitExprAsPredicate(DbExpression expr)
596private static IList<Node> VisitExpr(IList<DbExpression> exprs, VisitExprDelegate exprDelegate)
611private IList<Node> VisitExprAsScalar(IList<DbExpression> exprs)
788private Node VisitBoundExpressionPushBindingScope(DbExpression boundExpression, string bindingName)
802private Node VisitBoundExpression(DbExpression boundExpression, out Var boundVar)
975public override Node Visit(DbExpression e)
1084private Node VisitLambdaExpression(DbLambda lambda, IList<DbExpression> arguments, DbExpression applicationExpr, EdmFunction expandingEdmFunction)
1089foreach (DbExpression argExpr in arguments)
1208private bool TryRewriteKeyPropertyAccess(DbPropertyExpression propertyExpression, out DbExpression rewritten)
1224DbExpression navigationSource = instanceExpression.Instance.GetEntityRef();
1225DbExpression navigationExpression = navigationSource.Navigate(navigationProperty.FromEndMember, navigationProperty.ToEndMember);
1250DbExpression rewritten;
1511foreach (DbExpression arg in e.Arguments)
1857private DbFilterExpression CreateIsOfFilterExpression(DbExpression input, IsOfFilter typeFilter)
1861List<DbExpression> predicates = new List<DbExpression>(
1864DbExpression predicate = Helpers.BuildBalancedTreeInPlace(predicates, (left, right) => left.And(right));
1881DbExpression isOfArgument = ((DbIsOfExpression)filter.Predicate).Argument;
1886private DbExpression ApplyIsOfFilter(DbExpression current, IsOfFilter typeFilter)
1903DbExpression result;
1925DbExpression rewritten = ApplyIsOfFilter(filter.Input.Expression, typeFilter);
1938DbExpression rewrittenIsOf = ApplyIsOfFilter(ofTypeExp.Argument, typeFilter);
1967DbExpression sortInput = ApplyIsOfFilter(sort.Input.Expression, typeFilter);
2006DbExpression rewrittenIsOfFilter = ApplyIsOfFilter(e.Argument, new IsOfFilter(e));
2086foreach (DbExpression arg in e.Arguments)
2179DbExpression processed = ApplyIsOfFilter(e.Input.Expression, new IsOfFilter(isOfPredicate));
2206foreach (KeyValuePair<RelProperty, DbExpression> kv in _discriminatorMap.RelPropertyMap)
2221DbExpression value = propertyMap.Value;
2241private Node CreateNewInstanceArgument(EdmMember property, DbExpression value)
2277private Node VisitJoin(DbExpression e, IList<DbExpressionBinding> inputs, DbExpression joinCond)
2594DbExpression keyExpr = e.Keys[idx];
System\Data\SqlClient\SqlGen\Sql8ExpressionRewriter.cs (42)
51DbExpression newQuery = rewriter.VisitExpression(originalTree.Query);
69/// <see cref="TransformIntersectOrExcept(DbExpression left, DbExpression right, DbExpressionKind expressionKind, IList<DbPropertyExpression> sortExpressionsOverLeft, string sortExpressionsBindingVariableName)"/>
73public override DbExpression Visit(DbExceptExpression e)
79/// <see cref="TransformIntersectOrExcept(DbExpression left, DbExpression right, DbExpressionKind expressionKind, IList<DbPropertyExpression> sortExpressionsOverLeft, string sortExpressionsBindingVariableName)"/>
83public override DbExpression Visit(DbIntersectExpression e)
109/// NON-DISTINCT EXCEPT (specially translated, <see cref="TransformIntersectOrExcept(DbExpression left, DbExpression right, DbExpressionKind expressionKind, IList<DbPropertyExpression> sortExpressionsOverLeft, string sortExpressionsBindingVariableName)"/>
126public override DbExpression Visit(DbSkipExpression e)
129DbExpression rightInput = VisitExpressionBinding(e.Input).Sort(VisitSortOrder(e.SortOrder)).Limit(VisitExpression(e.Count));
132DbExpression leftInput = VisitExpression(e.Input.Expression); //Another copy of the input
147DbExpression exceptExpression = TransformIntersectOrExcept(leftInput, rightInput, DbExpressionKind.Skip, sortExpressions, e.Input.VariableName);
149DbExpression result = exceptExpression.BindAs(e.Input.VariableName).Sort(sortOrder);
159/// <see cref="TransformIntersectOrExcept(DbExpression left, DbExpression right, DbExpressionKind expressionKind, IList<DbPropertyExpression> sortExpressionsOverLeft, string sortExpressionsBindingVariableName)"/>
165private DbExpression TransformIntersectOrExcept(DbExpression left, DbExpression right, DbExpressionKind expressionKind)
208private DbExpression TransformIntersectOrExcept(DbExpression left, DbExpression right, DbExpressionKind expressionKind, IList<DbPropertyExpression> sortExpressionsOverLeft, string sortExpressionsBindingVariableName)
242DbExpression existsPredicate = null;
247DbExpression equalsExpression = leftFlattenedProperties[i].Equal(rightFlattenedProperties[i]);
250DbExpression leftIsNullExpression = leftFlattenedProperties[i].IsNull();
251DbExpression rightIsNullExpression = rightFlattenedProperties[i].IsNull();
252DbExpression bothNullExpression = leftIsNullExpression.And(rightIsNullExpression);
254DbExpression orExpression = equalsExpression.Or(bothNullExpression);
267DbExpression quantifierExpression = rightInputBinding.Any(existsPredicate);
269DbExpression filterPredicate;
282DbExpression result = leftInputBinding.Filter(filterPredicate);
298private void FlattenProperties(DbExpression input, IList<DbPropertyExpression> flattenedProperties)
305DbExpression propertyInput = input;
324/// Helper method for <see cref="TransformIntersectOrExcept(DbExpression left, DbExpression right, DbExpressionKind expressionKind, IList<DbPropertyExpression> sortExpressionsOverLeft, string sortExpressionsBindingVariableName)"/>
415/// Helper method for <see cref="TransformIntersectOrExcept(DbExpression left, DbExpression right, DbExpressionKind expressionKind, IList<DbPropertyExpression> sortExpressionsOverLeft, string sortExpressionsBindingVariableName)"/>
424List<KeyValuePair<string, DbExpression>> projectColumns = new List<KeyValuePair<string, DbExpression>>(flattenedProperties.Count);
450projectColumns.Add(new KeyValuePair<string, DbExpression>(name, pe));
454DbExpression rowExpr = DbExpressionBuilder.NewRow(projectColumns);
464foreach (KeyValuePair<string, DbExpression> column in projectColumns)
System\Data\SqlClient\SqlGen\SqlFunctionCallHandler.cs (13)
474private static readonly DbExpression defaultGeographySridExpression = DbExpressionBuilder.Constant(DbGeography.DefaultCoordinateSystemId);
475private static readonly DbExpression defaultGeometrySridExpression = DbExpressionBuilder.Constant(DbGeometry.DefaultCoordinateSystemId);
485DbExpression sridExpression = (TypeSemantics.IsPrimitiveType(functionExpression.ResultType, PrimitiveTypeKind.Geometry) ? defaultGeometrySridExpression : defaultGeographySridExpression);
681private static void WriteFunctionArguments(SqlGenerator sqlgen, IEnumerable<DbExpression> functionArguments, SqlBuilder result)
685foreach (DbExpression arg in functionArguments)
803DbExpression instanceExpression = functionExpression.Arguments[0];
1106private static ISqlFragment HandleCanonicalFunctionDateTimeTypeCreation(SqlGenerator sqlgen, string typeName, IList<DbExpression> args, bool hasDatePart, bool hasTimeZonePart)
1194private static void AppendConvertToVarchar(SqlGenerator sqlgen, SqlBuilder result, DbExpression e)
1512private static void TranslateConstantParameterForLike(SqlGenerator sqlgen, DbExpression targetExpression, DbConstantExpression constSearchParamExpression, SqlBuilder result, bool insertPercentStart, bool insertPercentEnd)
1553private static SqlBuilder HandleCanonicalFunctionContains(SqlGenerator sqlgen, IList<DbExpression> args, SqlBuilder result)
1596private static SqlBuilder HandleCanonicalFunctionStartsWith(SqlGenerator sqlgen, IList<DbExpression> args, SqlBuilder result)
1640private static SqlBuilder HandleCanonicalFunctionEndsWith(SqlGenerator sqlgen, IList<DbExpression> args, SqlBuilder result)
1678private static ISqlFragment WrapPredicate(Func<SqlGenerator, IList<DbExpression>, SqlBuilder, SqlBuilder> predicateTranslator, SqlGenerator sqlgen, DbFunctionExpression e)
System\Data\SqlClient\SqlGen\SqlGenerator.cs (61)
772private bool CheckIfForceNonUnicodeRequired(DbExpression e)
793private bool MatchPatternForForcingNonUnicode(DbExpression e)
805DbExpression left = compareExpr.Left;
806DbExpression right = compareExpr.Right;
817private bool MatchTargetPatternForForcingNonUnicode(DbExpression expr)
866private bool MatchSourcePatternForForcingNonUnicode(DbExpression argument)
879private bool IsConstParamOrNullExpressionUnicodeNotSpecified(DbExpression argument)
1228public override ISqlFragment Visit(DbExpression e)
1464foreach (DbExpression key in e.Keys)
1898var map = new KeyToListMap<DbExpression, DbExpression>(KeyFieldExpressionComparer.Singleton);
1909foreach (var key in map.Keys)
1942var value = realValues.First();
1954foreach(var value in realValues)
1985private void HandleInValue(SqlBuilder sqlBuilder, DbExpression value, bool isSameEdmType, bool forceNonUnicodeOnQualifyingValues)
1991private void HandleInKey(SqlBuilder sqlBuilder, DbExpression key, bool forceNonUnicodeOnKey)
2011private void ParenthesizeExpressionWithoutRedundantConstantCasts(DbExpression value, SqlBuilder sqlBuilder, Boolean isSameEdmType)
2036private class KeyFieldExpressionComparer: IEqualityComparer<DbExpression>
2050public bool Equals(DbExpression x, DbExpression y)
2090public int GetHashCode(DbExpression obj)
2123private bool IsKeyForIn(DbExpression e)
2137private bool TryAddExpressionForIn(DbBinaryExpression e, KeyToListMap<DbExpression, DbExpression> values)
2160private bool HasBuiltMapForIn(DbExpression e, KeyToListMap<DbExpression, DbExpression> values)
2170var potentialKey = ((DbIsNullExpression)e).Argument;
2691internal void ParenthesizeExpressionIfNeeded(DbExpression e, SqlBuilder result)
2716private SqlBuilder VisitBinaryExpression(string op, DbExpressionKind expressionKind, DbExpression left, DbExpression right)
2721foreach (DbExpression argument in SqlGenerator.FlattenAssociativeExpression(expressionKind, left, right))
2744private static IEnumerable<DbExpression> FlattenAssociativeExpression(DbExpressionKind kind, DbExpression left, DbExpression right)
2754List<DbExpression> argumentList = new List<DbExpression>();
2770private static void ExtractAssociativeArguments(DbExpressionKind expressionKind, List<DbExpression> argumentList, DbExpression expression)
2772IEnumerable<DbExpression> result = Helpers.GetLeafNodes(
2800private SqlBuilder VisitComparisonExpression(string op, DbExpression left, DbExpression right)
2842private SqlSelectStatement VisitInputExpression(DbExpression inputExpression,
2950foreach (DbExpression arg in e.Arguments)
3018string joinString, DbExpression joinCondition)
3270DbExpression argument = e.Arguments[i];
3319private ISqlFragment VisitSetOpExpression(DbExpression left, DbExpression right, string separator)
3893private ISqlFragment HandleCountExpression(DbExpression e)
3919static bool IsApplyExpression(DbExpression e)
3931static bool IsJoinExpression(DbExpression e)
3948private static bool IsComplexExpression(DbExpression e)
4045/// Simply calls <see cref="VisitExpressionEnsureSqlStatement(DbExpression, bool, bool)"/>
4050private SqlSelectStatement VisitExpressionEnsureSqlStatement(DbExpression e)
4078private SqlSelectStatement VisitExpressionEnsureSqlStatement(DbExpression e, bool addDefaultColumns, bool markAllDefaultColumnsAsUsed)
4149private SqlSelectStatement VisitFilterExpression(DbExpressionBinding input, DbExpression predicate, bool negatePredicate)
4275private static bool GroupByAggregateNeedsInnerQuery(DbExpression expression, string inputVarRefName)
4293static bool GroupByKeysNeedInnerQuery(IList<DbExpression> keys, string inputVarRefName)
4295foreach (DbExpression key in keys)
4316private static bool GroupByKeyNeedsInnerQuery(DbExpression expression, string inputVarRefName)
4332private static bool GroupByExpressionNeedsInnerQuery(DbExpression expression, string inputVarRefName, bool allowConstants)