public override void Visit(DbVariableReferenceExpression e) { Check.NotNull <DbVariableReferenceExpression>(e, nameof(e)); this._key.Append("Var("); this.VisitVariableName(e.VariableName); this._key.Append(")"); }
public override DbExpression Visit(DbVariableReferenceExpression expression) { Check.NotNull(expression, "expression"); var result = base.Visit(expression); if (result.ExpressionKind == DbExpressionKind.VariableReference) { var varRef = (DbVariableReferenceExpression)result; TypeUsage foundType = null; foreach (var scope in variableScopes) { if (scope.TryGetValue(varRef.VariableName, out foundType)) { break; } } if (foundType == null) { ThrowInvalid(Strings.Cqt_Validator_VarRefInvalid(varRef.VariableName)); } // SQLBUDT#545720: Equivalence is not a sufficient check (consider row types) - equality is required. if (!TypeSemantics.IsEqual(varRef.ResultType, foundType)) { ThrowInvalid(Strings.Cqt_Validator_VarRefTypeMismatch(varRef.VariableName)); } } return(result); }
internal DbGroupExpressionBinding( DbExpression input, DbVariableReferenceExpression inputRef, DbVariableReferenceExpression groupRef) { _expr = input; _varRef = inputRef; _groupVarRef = groupRef; }
public override TreeNode Visit(DbVariableReferenceExpression e) { TreeNode retInfo = new TreeNode(); retInfo.Text.AppendFormat("Var({0})", e.VariableName); return(retInfo); }
public override void Visit(DbVariableReferenceExpression expression) { Write(expression); _depth++; WriteLine("VariableName: " + expression.VariableName); _depth--; }
public override Expression Visit(DbVariableReferenceExpression expression) { string name = expression.VariableName; Variable context = this.currentVariables.GetVariable(name); return(context.Expression); }
public override SqlFragment Visit(DbVariableReferenceExpression expression) { PropertyFragment fragment = new PropertyFragment(); fragment.Properties.Add(expression.VariableName); return(fragment); }
public override void Visit(DbVariableReferenceExpression expression) { if (expression == null) { throw new ArgumentException("expression"); } }
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); }
public override Expression Visit(DbVariableReferenceExpression expression) { string name = expression.VariableName; Variable context = this.currentVariables.GetVariable(name); return context.Expression; }
public override DbExpression Visit(DbVariableReferenceExpression expression) { Check.NotNull <DbVariableReferenceExpression>(expression, nameof(expression)); DbExpression dbExpression = base.Visit(expression); if (dbExpression.ExpressionKind == DbExpressionKind.VariableReference) { DbVariableReferenceExpression referenceExpression = (DbVariableReferenceExpression)dbExpression; TypeUsage type2 = (TypeUsage)null; foreach (Dictionary <string, TypeUsage> variableScope in this.variableScopes) { if (variableScope.TryGetValue(referenceExpression.VariableName, out type2)) { break; } } if (type2 == null) { this.ThrowInvalid(Strings.Cqt_Validator_VarRefInvalid((object)referenceExpression.VariableName)); } if (!TypeSemantics.IsEqual(referenceExpression.ResultType, type2)) { this.ThrowInvalid(Strings.Cqt_Validator_VarRefTypeMismatch((object)referenceExpression.VariableName)); } } return(dbExpression); }
/// <summary> /// Rolls back the <see cref="AdjustToGroupVar"/>(...) adjustment, clears the <see cref="IGroupExpressionExtendedInfo.GroupVarBasedExpression"/>. /// </summary> internal void RollbackAdjustmentToGroupVar(DbVariableReferenceExpression pregroupParentVarRef) { Debug.Assert(_groupVarBasedExpression != null, "_groupVarBasedExpression != null"); _groupVarBasedExpression = null; _groupAggBasedExpression = null; ReplaceParentVar(pregroupParentVarRef); }
public override void Visit(DbVariableReferenceExpression e) { Dictionary <string, object> attrs = new Dictionary <string, object>(); attrs.Add("VariableName", e.VariableName); Begin(e, attrs); End(e); }
public NavigationInfo( DbRelationshipNavigationExpression originalNavigation, DbRelationshipNavigationExpression rewrittenNavigation) { this._sourceEnd = (AssociationEndMember)originalNavigation.NavigateFrom; this._sourceRef = (DbVariableReferenceExpression)rewrittenNavigation.NavigationSource; this._source = originalNavigation.NavigationSource; }
internal DbExpressionBinding(DbExpression input, DbVariableReferenceExpression varRef) { DebugCheck.NotNull(input); DebugCheck.NotNull(varRef); _expr = input; _varRef = varRef; }
public override TreeNode Visit(DbVariableReferenceExpression e) { Check.NotNull <DbVariableReferenceExpression>(e, nameof(e)); TreeNode treeNode = new TreeNode(); treeNode.Text.AppendFormat("Var({0})", (object)e.VariableName); return(treeNode); }
internal DbExpressionBinding(DbExpression input, DbVariableReferenceExpression varRef) { Debug.Assert(input != null, "DbExpressionBinding input cannot be null"); Debug.Assert(varRef != null, "DbExpressionBinding variable cannot be null"); _expr = input; _varRef = varRef; }
public override void Visit(DbVariableReferenceExpression e) { Check.NotNull(e, "e"); _key.Append("Var("); VisitVariableName(e.VariableName); _key.Append(")"); }
// <summary> // Rolls back the <see cref="AdjustToGroupVar" />(...) adjustment, clears the // <see // cref="IGroupExpressionExtendedInfo.GroupVarBasedExpression" /> // . // </summary> internal void RollbackAdjustmentToGroupVar(DbVariableReferenceExpression pregroupParentVarRef) { DebugCheck.NotNull(_groupVarBasedExpression); _groupVarBasedExpression = null; _groupAggBasedExpression = null; ReplaceParentVar(pregroupParentVarRef); }
public override DbExpression Visit(DbVariableReferenceExpression varRef) { Check.NotNull <DbVariableReferenceExpression>(varRef, nameof(varRef)); if (this.IsOuterBindingVarRef(varRef)) { this.m_doomed = true; } return(base.Visit(varRef)); }
public override DbExpression Visit(DbVariableReferenceExpression varRef) { // if we encounter an unsubstitutued var ref, give up... if (IsOuterBindingVarRef(varRef)) { m_doomed = true; } return(base.Visit(varRef)); }
// <summary> // Rebuild the current scope entry expression as the property chain off the <paramref name="parentVarRef" /> expression. // Also build // - <see cref="IGroupExpressionExtendedInfo.GroupVarBasedExpression" /> off the <paramref name="parentGroupVarRef" /> expression; // - <see cref="IGroupExpressionExtendedInfo.GroupAggBasedExpression" /> off the <paramref name="groupAggRef" /> expression. // This adjustment is reversable by <see cref="RollbackAdjustmentToGroupVar" />(...). // </summary> internal void AdjustToGroupVar( DbVariableReferenceExpression parentVarRef, DbVariableReferenceExpression parentGroupVarRef, DbVariableReferenceExpression groupAggRef) { // Adjustment is not reentrant. Debug.Assert(_groupVarBasedExpression == null, "_groupVarBasedExpression == null"); Debug.Assert(_groupAggBasedExpression == null, "_groupAggBasedExpression == null"); // // Let's assume this entry represents variable "x" in the following query: // select x, y, z from {1, 2} as x join {2, 3} as y on x = y join {3, 4} as z on y = z // In this case _propRefs contains x._##join0._##join1 and the corresponding input expression looks like this: // |_Input : '_##join1' // | |_InnerJoin // | |_Left : '_##join0' // | | |_InnerJoin // | | |_Left : 'x' // | | |_Right : 'y' // | |_Right : 'z' // When we start processing a group by, like in this query: // select k1, k2, k3 from {1, 2} as x join {2, 3} as y on x = y join {3, 4} as z on y = z group by x as k1, y as k2, z as k3 // we are switching to the following input expression: // |_Input : '_##geb2', '_##group3' // | |_InnerJoin // | |_Left : '_##join0' // | | |_InnerJoin // | | |_Left : 'x' // | | |_Right : 'y' // | |_Right : 'z' // where _##join1 is replaced by _##geb2 for the regular expression and by _##group3 for the group var based expression. // So the switch, or the adjustment, is done by // a. replacing _##join1 with _##geb2 in _propRefs and rebuilding the regular expression accordingly to get // the following property chain: _##geb2._##join1.x // b. building a group var based expression using _##group3 instead of _##geb2 to get // the following property chain: _##group3._##join1.x // // // Rebuild ScopeEntry.Expression using the new parent var. // ReplaceParentVar(parentVarRef); // // Build the GroupVarBasedExpression and GroupAggBasedExpression, // take into account that parentVarRef has already been added to the _propRefs in the AdjustToParentVar(...) call, so ignore it. // _groupVarBasedExpression = parentGroupVarRef; _groupAggBasedExpression = groupAggRef; if (_propRefs != null) { for (var i = _propRefs.Count - 2 /*ignore the parentVarRef*/; i >= 0; --i) { _groupVarBasedExpression = _groupVarBasedExpression.Property(_propRefs[i]); _groupAggBasedExpression = _groupAggBasedExpression.Property(_propRefs[i]); } } }
public override VisitedExpression Visit(DbPropertyExpression expression) { DbVariableReferenceExpression variable = expression.Instance as DbVariableReferenceExpression; if (variable == null || variable.VariableName != _projectVarName.Peek()) { throw new NotSupportedException(); } return(new PropertyExpression(expression.Property)); }
public NavigationInfo( DbRelationshipNavigationExpression originalNavigation, DbRelationshipNavigationExpression rewrittenNavigation) { DebugCheck.NotNull(originalNavigation); DebugCheck.NotNull(rewrittenNavigation); _sourceEnd = (AssociationEndMember)originalNavigation.NavigateFrom; _sourceRef = (DbVariableReferenceExpression)rewrittenNavigation.NavigationSource; _source = originalNavigation.NavigationSource; }
public NavigationInfo(DbRelationshipNavigationExpression originalNavigation, DbRelationshipNavigationExpression rewrittenNavigation) { Debug.Assert(originalNavigation != null, "originalNavigation cannot be null"); Debug.Assert(rewrittenNavigation != null, "rewrittenNavigation cannot be null"); this._original = originalNavigation; this._rewritten = rewrittenNavigation; this._sourceEnd = (AssociationEndMember)originalNavigation.NavigateFrom; this._sourceRef = (DbVariableReferenceExpression)rewrittenNavigation.NavigationSource; this._source = originalNavigation.NavigationSource; }
public override void Visit(DbVariableReferenceExpression e) { Check.NotNull <DbVariableReferenceExpression>(e, nameof(e)); this.Begin((DbExpression)e, new Dictionary <string, object>() { { "VariableName", (object)e.VariableName } }); this.End((DbExpression)e); }
internal void ReplaceParentVar(DbVariableReferenceExpression parentVarRef) { if (this._propRefs == null) { this._varBasedExpression = (DbExpression)parentVarRef; } else { this._propRefs.RemoveAt(this._propRefs.Count - 1); this.AddParentVar(parentVarRef); } }
private DbSetClause GetInsertSetClause(string column, DbExpression newValueToSetToDb, DbInsertCommandTree insertCommand) { // Create the variable reference in order to create the property DbVariableReferenceExpression variableReference = DbExpressionBuilder.Variable(insertCommand.Target.VariableType, insertCommand.Target.VariableName); // Create the property to which will assign the correct value DbPropertyExpression tenantProperty = DbExpressionBuilder.Property(variableReference, column); // Create the set clause, object representation of sql insert command DbSetClause newSetClause = DbExpressionBuilder.SetClause(tenantProperty, newValueToSetToDb); return(newSetClause); }
public override DbExpression Visit(DbRelationshipNavigationExpression expression) { this._original = expression; // Ensure a unique variable name when the expression is used in a command tree string varName = _aliasGenerator.Next(); DbVariableReferenceExpression sourceRef = new DbVariableReferenceExpression(expression.NavigationSource.ResultType, varName); this._rewritten = sourceRef.Navigate(expression.NavigateFrom, expression.NavigateTo); return(this._rewritten); }
internal SourceScopeEntry AddParentVar( DbVariableReferenceExpression parentVarRef) { if (this._propRefs == null) { this._propRefs = new List <string>(2); this._propRefs.Add(((DbVariableReferenceExpression)this._varBasedExpression).VariableName); } this._varBasedExpression = (DbExpression)parentVarRef; for (int index = this._propRefs.Count - 1; index >= 0; --index) { this._varBasedExpression = (DbExpression)this._varBasedExpression.Property(this._propRefs[index]); } this._propRefs.Add(parentVarRef.VariableName); return(this); }
/// <summary> /// Determines whether the given expression is a <see cref="DbPropertyExpression"/> /// over <see cref="DbVariableReferenceExpression"/> /// </summary> /// <param name="expression"></param> /// <returns></returns> static bool IsPropertyOverVarRef(DbExpression expression) { DbPropertyExpression propertyExpression = expression as DbPropertyExpression; if (propertyExpression == null) { return(false); } DbVariableReferenceExpression varRefExpression = propertyExpression.Instance as DbVariableReferenceExpression; if (varRefExpression == null) { return(false); } return(true); }
public override VisitedExpression Visit(DbPropertyExpression expression) { DbVariableReferenceExpression variable = expression.Instance as DbVariableReferenceExpression; if (variable == null || variable.VariableName != _projectVarName.Peek()) { throw new NotSupportedException(); } if (!_processingReturning) { return(new PropertyExpression(expression.Property)); } else { // the table name needs to be quoted, the column name does not. // http://archives.postgresql.org/pgsql-bugs/2007-01/msg00102.php string tableName = QuoteIdentifier(_variableSubstitution[variable.VariableName]); if (variable.VariableName == _commandTree.Target.VariableName) { // try to get the table name schema qualified. DbScanExpression scan = _commandTree.Target.Expression as DbScanExpression; if (scan != null) { #if ENTITIES6 System.Data.Entity.Core.Metadata.Edm.MetadataProperty metadata; #else System.Data.Metadata.Edm.MetadataProperty metadata; #endif string overrideSchema = "http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator:Schema"; if (scan.Target.MetadataProperties.TryGetValue(overrideSchema, false, out metadata) && metadata.Value != null) { tableName = QuoteIdentifier(metadata.Value.ToString()) + "." + tableName; } else if (scan.Target.MetadataProperties.TryGetValue("Schema", false, out metadata) && metadata.Value != null) { tableName = QuoteIdentifier(metadata.Value.ToString()) + "." + tableName; } else { tableName = QuoteIdentifier(scan.Target.EntityContainer.Name) + "." + tableName; } } } return(new LiteralExpression("currval(pg_get_serial_sequence('" + tableName + "', '" + expression.Property.Name + "'))")); } }
internal void AdjustToGroupVar( DbVariableReferenceExpression parentVarRef, DbVariableReferenceExpression parentGroupVarRef, DbVariableReferenceExpression groupAggRef) { this.ReplaceParentVar(parentVarRef); this._groupVarBasedExpression = (DbExpression)parentGroupVarRef; this._groupAggBasedExpression = (DbExpression)groupAggRef; if (this._propRefs == null) { return; } for (int index = this._propRefs.Count - 2; index >= 0; --index) { this._groupVarBasedExpression = (DbExpression)this._groupVarBasedExpression.Property(this._propRefs[index]); this._groupAggBasedExpression = (DbExpression)this._groupAggBasedExpression.Property(this._propRefs[index]); } }
/// <summary> /// This method determines whether an extent from an outer scope(free variable) /// is used in the CurrentSelectStatement. /// /// An extent in an outer scope, if its symbol is not in the FromExtents /// of the CurrentSelectStatement. /// </summary> /// <param name="e"></param> /// <returns>A <see cref="Symbol"/>.</returns> public override ISqlFragment Visit(DbVariableReferenceExpression e) { if (isVarRefSingle) { throw new NotSupportedException(); // A DbVariableReferenceExpression has to be a child of DbPropertyExpression or MethodExpression // This is also checked in GenerateSql(...) at the end of the visiting. } isVarRefSingle = true; // This will be reset by DbPropertyExpression or MethodExpression var result = symbolTable.Lookup(e.VariableName); if (!CurrentSelectStatement.FromExtents.Contains(result)) { CurrentSelectStatement.OuterExtents[result] = true; } return(result); }
/// <summary> /// Replace existing var at the head of the property chain with the new <paramref name="parentVarRef" />. /// </summary> internal void ReplaceParentVar(DbVariableReferenceExpression parentVarRef) { // // No parent var adjustment is allowed while adjusted to group var (see AdjustToGroupVar(...) for more info). // Debug.Assert(_groupVarBasedExpression == null, "_groupVarBasedExpression == null"); Debug.Assert(_groupAggBasedExpression == null, "_groupAggBasedExpression == null"); if (_propRefs == null) { Debug.Assert(_varBasedExpression is DbVariableReferenceExpression, "_varBasedExpression is DbVariableReferenceExpression"); _varBasedExpression = parentVarRef; } else { Debug.Assert(_propRefs.Count > 0, "_propRefs.Count > 0"); _propRefs.RemoveAt(_propRefs.Count - 1); AddParentVar(parentVarRef); } }
/// <summary> /// Prepend <paramref name="parentVarRef" /> to the property chain. /// </summary> internal SourceScopeEntry AddParentVar(DbVariableReferenceExpression parentVarRef) { // // No parent var adjustment is allowed while adjusted to group var (see AdjustToGroupVar(...) for more info). // Debug.Assert(_groupVarBasedExpression == null, "_groupVarBasedExpression == null"); Debug.Assert(_groupAggBasedExpression == null, "_groupAggBasedExpression == null"); if (_propRefs == null) { Debug.Assert(_varBasedExpression is DbVariableReferenceExpression, "_varBasedExpression is DbVariableReferenceExpression"); _propRefs = new List<string>(2); _propRefs.Add(((DbVariableReferenceExpression)_varBasedExpression).VariableName); } _varBasedExpression = parentVarRef; for (var i = _propRefs.Count - 1; i >= 0; --i) { _varBasedExpression = _varBasedExpression.Property(_propRefs[i]); } _propRefs.Add(parentVarRef.VariableName); return this; }
public override void Visit(DbVariableReferenceExpression e) { _key.Append("Var("); VisitVariableName(e.VariableName); _key.Append(")"); }
public override DbExpression Visit(DbVariableReferenceExpression expression) { return _binding.VariableType.Variable(_binding.VariableName); }
public override void Visit(DbVariableReferenceExpression expression) { Contract.Requires(expression != null); }
// <summary> // Rolls back the <see cref="AdjustToGroupVar" />(...) adjustment, clears the // <see // cref="IGroupExpressionExtendedInfo.GroupVarBasedExpression" /> // . // </summary> internal void RollbackAdjustmentToGroupVar(DbVariableReferenceExpression pregroupParentVarRef) { DebugCheck.NotNull(_groupVarBasedExpression); _groupVarBasedExpression = null; _groupAggBasedExpression = null; ReplaceParentVar(pregroupParentVarRef); }
public override DbExpression Visit(DbVariableReferenceExpression expression) { System.Diagnostics.Debug.Print("Visit(DbVariableReferenceExpression): VariableName={0}, ResultType.EdmType.Name={1}", expression.VariableName, expression.ResultType.EdmType.Name); return base.Visit(expression); }
public override void Visit(DbVariableReferenceExpression expression) { }
internal SourceScopeEntry(DbVariableReferenceExpression varRef) : this(varRef, null) { }
internal SourceScopeEntry(DbVariableReferenceExpression varRef, string[] alternativeName) : base(ScopeEntryKind.SourceVar) { _varBasedExpression = varRef; _alternativeName = alternativeName; }
/// <summary> /// Rolls back the <see cref="AdjustToGroupVar" />(...) adjustment, clears the <see /// cref="IGroupExpressionExtendedInfo.GroupVarBasedExpression" />. /// </summary> internal void RollbackAdjustmentToGroupVar(DbVariableReferenceExpression pregroupParentVarRef) { Debug.Assert(_groupVarBasedExpression != null, "_groupVarBasedExpression != null"); _groupVarBasedExpression = null; _groupAggBasedExpression = null; ReplaceParentVar(pregroupParentVarRef); }
/// <summary> /// Rebuild the current scope entry expression as the property chain off the <paramref name="parentVarRef" /> expression. /// Also build /// - <see cref="IGroupExpressionExtendedInfo.GroupVarBasedExpression" /> off the <paramref name="parentGroupVarRef" /> expression; /// - <see cref="IGroupExpressionExtendedInfo.GroupAggBasedExpression" /> off the <paramref name="groupAggRef" /> expression. /// This adjustment is reversable by <see cref="RollbackAdjustmentToGroupVar" />(...). /// </summary> internal void AdjustToGroupVar( DbVariableReferenceExpression parentVarRef, DbVariableReferenceExpression parentGroupVarRef, DbVariableReferenceExpression groupAggRef) { // Adjustment is not reentrant. Debug.Assert(_groupVarBasedExpression == null, "_groupVarBasedExpression == null"); Debug.Assert(_groupAggBasedExpression == null, "_groupAggBasedExpression == null"); // // Let's assume this entry represents variable "x" in the following query: // select x, y, z from {1, 2} as x join {2, 3} as y on x = y join {3, 4} as z on y = z // In this case _propRefs contains x._##join0._##join1 and the corresponding input expression looks like this: // |_Input : '_##join1' // | |_InnerJoin // | |_Left : '_##join0' // | | |_InnerJoin // | | |_Left : 'x' // | | |_Right : 'y' // | |_Right : 'z' // When we start processing a group by, like in this query: // select k1, k2, k3 from {1, 2} as x join {2, 3} as y on x = y join {3, 4} as z on y = z group by x as k1, y as k2, z as k3 // we are switching to the following input expression: // |_Input : '_##geb2', '_##group3' // | |_InnerJoin // | |_Left : '_##join0' // | | |_InnerJoin // | | |_Left : 'x' // | | |_Right : 'y' // | |_Right : 'z' // where _##join1 is replaced by _##geb2 for the regular expression and by _##group3 for the group var based expression. // So the switch, or the adjustment, is done by // a. replacing _##join1 with _##geb2 in _propRefs and rebuilding the regular expression accordingly to get // the following property chain: _##geb2._##join1.x // b. building a group var based expression using _##group3 instead of _##geb2 to get // the following property chain: _##group3._##join1.x // // // Rebuild ScopeEntry.Expression using the new parent var. // ReplaceParentVar(parentVarRef); // // Build the GroupVarBasedExpression and GroupAggBasedExpression, // take into account that parentVarRef has already been added to the _propRefs in the AdjustToParentVar(...) call, so ignore it. // _groupVarBasedExpression = parentGroupVarRef; _groupAggBasedExpression = groupAggRef; if (_propRefs != null) { for (var i = _propRefs.Count - 2 /*ignore the parentVarRef*/; i >= 0; --i) { _groupVarBasedExpression = _groupVarBasedExpression.Property(_propRefs[i]); _groupAggBasedExpression = _groupAggBasedExpression.Property(_propRefs[i]); } } }
/// <summary> /// Visitor pattern method for <see cref="DbVariableReferenceExpression" />. /// </summary> /// <param name="expression"> The DbVariableReferenceExpression that is being visited. </param> /// <exception cref="ArgumentNullException"> /// <paramref name="expression" /> /// is null /// </exception> public override void Visit(DbVariableReferenceExpression expression) { // #433613: PreSharp warning 56506: Parameter 'expression' to this public method must be validated: A null-dereference can occur here. Check.NotNull(expression, "expression"); }
public override DbExpression Visit(DbVariableReferenceExpression varRef) { // if we encounter an unsubstitutued var ref, give up... if (IsOuterBindingVarRef(varRef)) { m_doomed = true; } return base.Visit(varRef); }
/// <summary> /// Visitor pattern method for DbVariableReferenceExpression. /// </summary> /// <param name="expression"> The DbVariableReferenceExpression that is being visited. </param> public abstract void Visit(DbVariableReferenceExpression expression);
/// <summary> /// Heuristic check to make sure the var ref is the one we're supposed to be replacing. /// </summary> private bool IsOuterBindingVarRef(DbVariableReferenceExpression varRef) { return varRef.VariableName == m_outerBinding.VariableName; }
public override void Visit(DbVariableReferenceExpression expression) { throw new NotSupportedException("Visit(\"VariableReferenceExpression\") is not supported."); }
internal FreeVariableScopeEntry(DbVariableReferenceExpression varRef) : base(ScopeEntryKind.FreeVar) { _varRef = varRef; }
private static DbVariableReferenceExpression[] CreateVariables(MethodInfo lambdaMethod, params TypeUsage[] argumentTypes) { Debug.Assert(lambdaMethod != null, "Lambda function method must not be null"); var paramNames = DbExpressionBuilder.ExtractAliases(lambdaMethod); Debug.Assert(paramNames.Length == argumentTypes.Length, "Lambda function method parameter count does not match argument count"); var result = new DbVariableReferenceExpression[argumentTypes.Length]; for (var idx = 0; idx < paramNames.Length; idx++) { Debug.Assert(argumentTypes[idx] != null, "DbLambda.Create allowed null type argument"); result[idx] = argumentTypes[idx].Variable(paramNames[idx]); } return result; }
public override void Visit(DbVariableReferenceExpression expression) { if (expression == null) throw new ArgumentException("expression"); }
public NavigationInfo(DbRelationshipNavigationExpression originalNavigation, DbRelationshipNavigationExpression rewrittenNavigation) { Debug.Assert(originalNavigation != null, "originalNavigation cannot be null"); Debug.Assert(rewrittenNavigation != null, "rewrittenNavigation cannot be null"); this._original = originalNavigation; this._rewritten = rewrittenNavigation; this._sourceEnd = (AssociationEndMember)originalNavigation.NavigateFrom; this._sourceRef = (DbVariableReferenceExpression)rewrittenNavigation.NavigationSource; this._source = originalNavigation.NavigationSource; }
/// <summary> /// Visitor pattern method for <see cref="DbVariableReferenceExpression" />. /// </summary> /// <param name="expression"> The DbVariableReferenceExpression that is being visited. </param> /// <exception cref="ArgumentNullException"> /// <paramref name="expression" /> /// is null /// </exception> public override void Visit(DbVariableReferenceExpression expression) { Check.NotNull(expression, "expression"); }
public override void Visit(DbVariableReferenceExpression e) { Dictionary<string, object> attrs = new Dictionary<string, object>(); attrs.Add("VariableName", e.VariableName); Begin(e, attrs); End(e); }
public NavigationInfo( DbRelationshipNavigationExpression originalNavigation, DbRelationshipNavigationExpression rewrittenNavigation) { DebugCheck.NotNull(originalNavigation); DebugCheck.NotNull(rewrittenNavigation); _sourceEnd = (AssociationEndMember)originalNavigation.NavigateFrom; _sourceRef = (DbVariableReferenceExpression)rewrittenNavigation.NavigationSource; _source = originalNavigation.NavigationSource; }
public override DbExpression Visit(DbRelationshipNavigationExpression expression) { this._original = expression; // Ensure a unique variable name when the expression is used in a command tree string varName = _aliasGenerator.Next(); DbVariableReferenceExpression sourceRef = new DbVariableReferenceExpression(expression.NavigationSource.ResultType, varName); this._rewritten = sourceRef.Navigate(expression.NavigateFrom, expression.NavigateTo); return this._rewritten; }