Here are the examples of the csharp api class System.Data.Common.CommandTrees.DbExpression.BindAs(string) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
37 Examples
0
1. Example
Project: referencesource
Source File: MethodCallTranslator.cs
Source File: MethodCallTranslator.cs
protected override CqtExpression TranslatePagingOperator(ExpressionConverter parent, CqtExpression operand, CqtExpression count) { return parent.Skip(operand.BindAs(parent.AliasGenerator.Next()), count); }
0
2. Example
Project: referencesource
Source File: MethodCallTranslator.cs
Source File: MethodCallTranslator.cs
internal override CqtExpression Translate(ExpressionConverter parent, MethodCallExpression call) { // Translate source CqtExpression source = parent.TranslateSet(call.Arguments[0]); // Figure out the type to cast to Type toClrType = TypeSystem.GetElementType(call.Type); Type fromClrType = TypeSystem.GetElementType(call.Arguments[0].Type); // Get binding to the elements of the input source DbExpressionBinding binding = source.BindAs(parent.AliasGenerator.Next()); CqtExpression cast = parent.CreateCastExpression(binding.Variable, toClrType, fromClrType); return parent.Project(binding, cast); }
0
3. Example
Project: referencesource
Source File: UpdateCompiler.cs
Source File: UpdateCompiler.cs
private static DbExpressionBinding GetTarget(TableChangeProcessor processor) { Debug.Assert(null != processor); // use a fixed var name since the command trees all have exactly one binding return processor.Table.Scan().BindAs(s_targetVarName); }
0
4. Example
Project: referencesource
Source File: MethodCallTranslator.cs
Source File: MethodCallTranslator.cs
protected override CqtExpression TranslateOneLambda(ExpressionConverter parent, DbExpressionBinding sourceBinding, CqtExpression lambda) { // elements of the inner selector should be used lambda = parent.NormalizeSetSource(lambda); DbExpressionBinding applyBinding = lambda.BindAs(parent.AliasGenerator.Next()); DbApplyExpression crossApply = sourceBinding.CrossApply(applyBinding); return crossApply; }
0
5. Example
Project: referencesource
Source File: OrderByLifter.cs
Source File: OrderByLifter.cs
protected DbProjectExpression RebindProject(DbExpression input, DbProjectExpression project) { DbExpressionBinding inputBinding = input.BindAs(project.Input.VariableName); return inputBinding.Project(project.Projection); }
0
6. Example
Project: referencesource
Source File: OrderByLifter.cs
Source File: OrderByLifter.cs
protected DbFilterExpression RebindFilter(DbExpression input, DbFilterExpression filter) { DbExpressionBinding inputBinding = input.BindAs(filter.Input.VariableName); return inputBinding.Filter(filter.Predicate); }
0
7. Example
Project: referencesource
Source File: OrderByLifter.cs
Source File: OrderByLifter.cs
protected DbSortExpression RebindSort(DbExpression input, DbSortExpression sort) { DbExpressionBinding inputBinding = input.BindAs(sort.Input.VariableName); return inputBinding.Sort(sort.SortOrder); }
0
8. Example
Project: referencesource
Source File: OrderByLifter.cs
Source File: OrderByLifter.cs
protected DbSortExpression ApplySkipOrderToSort(DbExpression input, DbSkipExpression sortSpec) { DbExpressionBinding inputBinding = input.BindAs(sortSpec.Input.VariableName); return inputBinding.Sort(sortSpec.SortOrder); }
0
9. Example
Project: referencesource
Source File: OrderByLifter.cs
Source File: OrderByLifter.cs
protected DbSkipExpression ApplySortOrderToSkip(DbExpression input, DbSortExpression sort, DbExpression k) { DbExpressionBinding inputBinding = input.BindAs(sort.Input.VariableName); return inputBinding.Skip(sort.SortOrder, k); }
0
10. Example
Project: referencesource
Source File: OrderByLifter.cs
Source File: OrderByLifter.cs
protected DbSkipExpression RebindSkip(DbExpression input, DbSkipExpression skip, DbExpression k) { DbExpressionBinding inputBinding = input.BindAs(skip.Input.VariableName); return inputBinding.Skip(skip.SortOrder, k); }
0
11. Example
Project: referencesource
Source File: ExpressionConverter.cs
Source File: ExpressionConverter.cs
private DbExpression TranslateLambda(LambdaExpression lambda, DbExpression input, out DbExpressionBinding binding) { input = NormalizeSetSource(input); // create binding context for this lambda expression binding = input.BindAs(_aliasGenerator.Next()); return TranslateLambda(lambda, binding.Variable); }
0
12. Example
Project: referencesource
Source File: ExpressionConverter.cs
Source File: ExpressionConverter.cs
private DbExpression TranslateLambda(LambdaExpression lambda, DbExpression input, string bindingName, out DbExpressionBinding binding) { input = NormalizeSetSource(input); // create binding context for this lambda expression binding = input.BindAs(bindingName); return TranslateLambda(lambda, binding.Variable); }
0
13. Example
Project: referencesource
Source File: MethodCallTranslator.cs
Source File: MethodCallTranslator.cs
protected virtual CqtExpression WrapCollectionOperand(ExpressionConverter parent, CqtExpression operand, TypeUsage returnType) { // check if the operand needs to be wrapped to ensure the correct function overload is called if (!TypeUsageEquals(returnType, ((CollectionType)operand.ResultType.EdmType).TypeUsage)) { DbExpressionBinding operandCastBinding = operand.BindAs(parent.AliasGenerator.Next()); DbProjectExpression operandCastProjection = operandCastBinding.Project(operandCastBinding.Variable.CastTo(returnType)); operand = operandCastProjection; } return operand; }
0
14. Example
Project: referencesource
Source File: MethodCallTranslator.cs
Source File: MethodCallTranslator.cs
protected override CqtExpression WrapCollectionOperand(ExpressionConverter parent, CqtExpression operand, TypeUsage returnType) { // always count a constant value DbProjectExpression constantProject = operand.BindAs(parent.AliasGenerator.Next()).Project(DbExpressionBuilder.Constant(1)); return constantProject; }
0
15. Example
Project: referencesource
Source File: MethodCallTranslator.cs
Source File: MethodCallTranslator.cs
private static DbExpression ProcessResultSelector(ExpressionConverter parent, MethodCallExpression c/n ..... /n //View Source file for more details /n }
0
16. Example
Project: referencesource
Source File: ObjectSpanRewriter.cs
Source File: ObjectSpanRewriter.cs
public override DbExpression Visit(DbFilterExpression expression) { // Only consider the Filter input DbExpression found = Find(expression.Input.Expression); if(!object.ReferenceEquals(found, expression.Input.Expression)) { return found.BindAs(expression.Input.VariableName).Filter(expression.Predicate); } else { return expression; } }
0
17. Example
Project: referencesource
Source File: ObjectSpanRewriter.cs
Source File: ObjectSpanRewriter.cs
public override DbExpression Visit(DbProjectExpression expression) { // Only allowed cases: // SELECT Deref(x) FROM <expression> AS x // SELECT x FROM <expression> as x DbExpression testExpr = expression.Projection; if (DbExpressionKind.Deref == testExpr.ExpressionKind) { testExpr = ((DbDerefExpression)testExpr).Argument; } if (DbExpressionKind.VariableReference == testExpr.ExpressionKind) { DbVariableReferenceExpression varRef = (DbVariableReferenceExpression)testExpr; if (varRef.VariableName.Equals(expression.Input.VariableName, StringComparison.Ordinal)) { DbExpression found = Find(expression.Input.Expression); if (!object.ReferenceEquals(found, expression.Input.Expression)) { return found.BindAs(expression.Input.VariableName).Project(expression.Projection); } } } return expression; }
0
18. Example
Project: referencesource
Source File: ObjectSpanRewriter.cs
Source File: ObjectSpanRewriter.cs
public override DbExpression Visit(DbSortExpression expression) { DbExpression found = Find(expression.Input.Expression); if(!object.ReferenceEquals(found, expression.Input.Expression)) { return found.BindAs(expression.Input.VariableName).Sort(expression.SortOrder); } else { return expression; } }
0
19. Example
Project: referencesource
Source File: ObjectSpanRewriter.cs
Source File: ObjectSpanRewriter.cs
public override DbExpression Visit(DbSkipExpression expression) { DbExpression found = Find(expression.Input.Expression); if (!object.ReferenceEquals(found, expression.Input.Expression)) { return found.BindAs(expression.Input.VariableName).Skip(expression.SortOrder, expression.Count); } else { return expression; } }
0
20. Example
Project: referencesource
Source File: SemanticAnalyzer.cs
Source File: SemanticAnalyzer.cs
private static DbExpressionBinding ProcessAliasedFromClauseItem(AST.AliasedExpr aliasedExpr, Semanti/n ..... /n //View Source file for more details /n }
0
21. Example
Project: referencesource
Source File: Sql8ExpressionRewriter.cs
Source File: Sql8ExpressionRewriter.cs
public override DbExpression Visit(DbSkipExpression e) { //Build the right input of the except DbExpression rightInput = VisitExpressionBinding(e.Input).Sort(VisitSortOrder(e.SortOrder)).Limit(VisitExpression(e.Count)); //Build the left input for the except DbExpression leftInput = VisitExpression(e.Input.Expression); //Another copy of the input IList<DbSortClause> sortOrder = VisitSortOrder(e.SortOrder); //Another copy of the sort order // Create a list of the sort expressions to be used for translating except IList<DbPropertyExpression> sortExpressions = new List<DbPropertyExpression>(e.SortOrder.Count); foreach (DbSortClause sortClause in sortOrder) { //We only care about property expressions, not about constants if (sortClause.Expression.ExpressionKind == DbExpressionKind.Property) { sortExpressions.Add((DbPropertyExpression)sortClause.Expression); } } DbExpression exceptExpression = TransformIntersectOrExcept(leftInput, rightInput, DbExpressionKind.Skip, sortExpressions, e.Input.VariableName); DbExpression result = exceptExpression.BindAs(e.Input.VariableName).Sort(sortOrder); return result; }
0
22. Example
Project: referencesource
Source File: SemanticAnalyzer.cs
Source File: SemanticAnalyzer.cs
private static DbExpressionBinding ProcessWhereHavingClausePredicate(DbExpressionBinding source, AST/n ..... /n //View Source file for more details /n }
0
23. Example
Project: referencesource
Source File: SemanticAnalyzer.cs
Source File: SemanticAnalyzer.cs
private static DbExpression ConvertQueryStatementToDbExpression(AST.Statement astStatement, Semantic/n ..... /n //View Source file for more details /n }
0
24. Example
Project: referencesource
Source File: SemanticAnalyzer.cs
Source File: SemanticAnalyzer.cs
private static DbExpressionBinding ProcessFromClause(AST.FromClause fromClause, SemanticResolver sr)/n ..... /n //View Source file for more details /n }
0
25. Example
Project: referencesource
Source File: MethodCallTranslator.cs
Source File: MethodCallTranslator.cs
internal static DbExpression TranslateContains(ExpressionConverter parent, Expression sourceExpressi/n ..... /n //View Source file for more details /n }
0
26. Example
Project: referencesource
Source File: MethodCallTranslator.cs
Source File: MethodCallTranslator.cs
internal override CqtExpression Translate(ExpressionConverter parent, MethodCallExpression call, Seq/n ..... /n //View Source file for more details /n }
0
27. Example
Project: referencesource
Source File: OrderByLifter.cs
Source File: OrderByLifter.cs
internal virtual DbExpression OfType(TypeUsage type) { // s.OfType<T> is normally translated to s.Filter(e => e is T).Project(e => e as T) DbExpressionBinding rootBinding = _root.BindAs(_aliasGenerator.Next()); DbExpression filter = this.Filter(rootBinding.Filter(rootBinding.Variable.IsOf(type))); OrderByLifterBase filterLifter = GetLifter(filter, _aliasGenerator); DbExpressionBinding filterBinding = filter.BindAs(_aliasGenerator.Next()); DbExpression project = filterLifter.Project(filterBinding.Project(filterBinding.Variable.TreatAs(type))); return project; }
0
28. Example
Project: referencesource
Source File: FunctionImportMappingComposable.cs
Source File: FunctionImportMappingComposable.cs
private DbExpression GenerateStructuralTypeResultMappingView(DbExpression storeFunctionInvoke, IList/n ..... /n //View Source file for more details /n }
0
29. Example
Project: referencesource
Source File: MethodCallTranslator.cs
Source File: MethodCallTranslator.cs
internal override DbExpression Translate(ExpressionConverter parent, MethodCallExpression call) /n ..... /n //View Source file for more details /n }
0
30. Example
Project: referencesource
Source File: ObjectSpanRewriter.cs
Source File: ObjectSpanRewriter.cs
private DbExpression RewriteCollection(DbExpression expression, CollectionType collectionType) /n ..... /n //View Source file for more details /n }
0
31. Example
Project: referencesource
Source File: ObjectContext.cs
Source File: ObjectContext.cs
private int BatchRefreshEntitiesByKey(RefreshMode refreshMode, Dictionary<EntityKey, EntityEntry&/n ..... /n //View Source file for more details /n }
0
32. Example
Project: referencesource
Source File: ITreeGenerator.cs
Source File: ITreeGenerator.cs
private DbExpression ApplyIsOfFilter(DbExpression current, IsOfFilter typeFilter) { /n ..... /n //View Source file for more details /n }
0
33. Example
Project: referencesource
Source File: SemanticAnalyzer.cs
Source File: SemanticAnalyzer.cs
private static DbExpressionBinding ProcessOrderByClause(DbExpressionBinding source, AST.QueryExpr qu/n ..... /n //View Source file for more details /n }
0
34. Example
Project: referencesource
Source File: ViewSimplifier.cs
Source File: ViewSimplifier.cs
private static DbExpression SimplifyNestedTphDiscriminator(DbExpression expression) { /n ..... /n //View Source file for more details /n }
0
35. Example
Project: referencesource
Source File: SemanticAnalyzer.cs
Source File: SemanticAnalyzer.cs
private static DbExpressionBinding ProcessGroupByClause(DbExpressionBinding source, AST.QueryExpr qu/n ..... /n //View Source file for more details /n }
0
36. Example
Project: referencesource
Source File: MethodCallTranslator.cs
Source File: MethodCallTranslator.cs
internal override CqtExpression Translate(ExpressionConverter parent, MethodCallExpression call) /n ..... /n //View Source file for more details /n }
0
37. Example
Project: referencesource
Source File: SemanticAnalyzer.cs
Source File: SemanticAnalyzer.cs
private static Dictionary<AST.BuiltInKind, BuiltInExprConverter> CreateBuiltInExprConverter() /n ..... /n //View Source file for more details /n }