Пример #1
0
        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 DbExpression Visit(DbVariableReferenceExpression expression)
        {
            EntityUtil.CheckArgumentNull(expression, "expression");

            DbExpression result = expression;
            DbVariableReferenceExpression newRef;

            if (this.varMappings.TryGetValue(expression, out newRef))
            {
                result = newRef;
            }
            NotifyIfChanged(expression, result);
            return(result);
        }
 private void RebindVariable(DbVariableReferenceExpression from, DbVariableReferenceExpression to)
 {
     //
     // The variable is only considered rebound if the name and/or type is different.
     // Otherwise, the original variable reference and the new variable reference are
     // equivalent, and no rebinding of references to the old variable is necessary.
     //
     // When considering the new/old result types,  the TypeUsage instance may be equal
     // or equivalent, but the EdmType must be the same instance, so that expressions
     // such as a DbPropertyExpression with the DbVariableReferenceExpression as the Instance
     // continue to be valid.
     //
     if (!from.VariableName.Equals(to.VariableName, StringComparison.Ordinal) ||
         !object.ReferenceEquals(from.ResultType.EdmType, to.ResultType.EdmType) ||
         !from.ResultType.EdmEquals(to.ResultType))
     {
         this.varMappings[from] = to;
         this.OnVariableRebound(from, to);
     }
 }
Пример #4
0
 internal DbGroupExpressionBinding(DbExpression input, DbVariableReferenceExpression inputRef, DbVariableReferenceExpression groupRef)
 {
     _expr        = input;
     _varRef      = inputRef;
     _groupVarRef = groupRef;
 }
 /// <summary>
 /// Typed visitor pattern method for DbVariableReferenceExpression.
 /// </summary>
 /// <param name="expression">The DbVariableReferenceExpression that is being visited.</param>
 /// <returns>An instance of TResultType.</returns>
 public abstract TResultType Visit(DbVariableReferenceExpression expression);
 /// <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.
     EntityUtil.CheckArgumentNull(expression, "expression");
 }
Пример #7
0
 /// <summary>
 /// Visitor pattern method for DbVariableReferenceExpression.
 /// </summary>
 /// <param name="expression">The DbVariableReferenceExpression that is being visited.</param>
 public abstract void Visit(DbVariableReferenceExpression expression);
 protected virtual void OnVariableRebound(DbVariableReferenceExpression fromVarRef, DbVariableReferenceExpression toVarRef)
 {
 }