internal DbGroupExpressionBinding(
     DbExpression input, DbVariableReferenceExpression inputRef, DbVariableReferenceExpression groupRef)
 {
     _expr        = input;
     _varRef      = inputRef;
     _groupVarRef = groupRef;
 }
        internal DbExpressionBinding(DbExpression input, DbVariableReferenceExpression varRef)
        {
            DebugCheck.NotNull(input);
            DebugCheck.NotNull(varRef);

            _expr   = input;
            _varRef = varRef;
        }
        public override DbExpression Visit(DbVariableReferenceExpression expression)
        {
            Check.NotNull(expression, "expression");

            DbExpression result = expression;
            DbVariableReferenceExpression newRef;

            if (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)
         ||
         !ReferenceEquals(from.ResultType.EdmType, to.ResultType.EdmType)
         ||
         !from.ResultType.EdmEquals(to.ResultType))
     {
         varMappings[from] = to;
         OnVariableRebound(from, to);
     }
 }
Example #5
0
 /// <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");
 }
 /// <summary>
 /// When overridden in a derived class, implements the visitor pattern for
 /// <see
 ///     cref="T:System.Data.Entity.Core.Common.CommandTrees.DbVariableReferenceExpression" />
 /// .
 /// </summary>
 /// <returns>A result value of a specific type.</returns>
 /// <param name="expression">
 /// The <see cref="T:System.Data.Entity.Core.Common.CommandTrees.DbVariableReferenceExpression" /> that is being visited.
 /// </param>
 public abstract TResultType Visit(DbVariableReferenceExpression expression);
 /// <summary>
 /// When overridden in a derived class, implements the visitor pattern for
 /// <see cref="T:System.Data.Entity.Core.Common.CommandTrees.DbVariableReferenceExpression" />
 /// .
 /// </summary>
 /// <param name="expression">
 /// The <see cref="T:System.Data.Entity.Core.Common.CommandTrees.DbVariableReferenceExpression" /> that is visited.
 /// </param>
 public abstract void Visit(DbVariableReferenceExpression expression);
 public override void Visit(DbVariableReferenceExpression expression)
 {
 }
 protected virtual void OnVariableRebound(DbVariableReferenceExpression fromVarRef, DbVariableReferenceExpression toVarRef)
 {
 }
 internal DbExpressionBinding(DbExpression input, DbVariableReferenceExpression varRef)
 {
     this._expr   = input;
     this._varRef = varRef;
 }
Example #11
0
 /// <summary>
 /// Visitor pattern method for <see cref="T:System.Data.Entity.Core.Common.CommandTrees.DbVariableReferenceExpression" />.
 /// </summary>
 /// <param name="expression"> The DbVariableReferenceExpression that is being visited. </param>
 /// <exception cref="T:System.ArgumentNullException">
 /// <paramref name="expression" />
 /// is null
 /// </exception>
 public override void Visit(DbVariableReferenceExpression expression)
 {
     Check.NotNull <DbVariableReferenceExpression>(expression, nameof(expression));
 }