Exemplo n.º 1
0
        protected virtual ReadOnlyCollection <DbColumnAssignment> VisitColumnAssignments(
            ReadOnlyCollection <DbColumnAssignment> assignments)
        {
            List <DbColumnAssignment> alternate = null;

            for (int i = 0, n = assignments.Count; i < n; i++)
            {
                DbColumnAssignment assignment = VisitColumnAssignment(assignments[i]);
                if (alternate == null && assignment != assignments[i])
                {
                    alternate = assignments.Take(i).ToList();
                }

                if (alternate != null)
                {
                    alternate.Add(assignment);
                }
            }
            if (alternate != null)
            {
                return(alternate.AsReadOnly());
            }

            return(assignments);
        }
Exemplo n.º 2
0
        protected virtual DbColumnAssignment VisitColumnAssignment(DbColumnAssignment ca)
        {
            DbColumnExpression c = (DbColumnExpression)Visit(ca.Column);
            Expression         e = Visit(ca.Expression);

            return(UpdateColumnAssignment(ca, c, e));
        }
Exemplo n.º 3
0
        protected DbColumnAssignment UpdateColumnAssignment(
            DbColumnAssignment ca, DbColumnExpression c, Expression e)
        {
            if (c != ca.Column || e != ca.Expression)
            {
                return(new DbColumnAssignment(c, e));
            }

            return(ca);
        }
Exemplo n.º 4
0
        protected override DbColumnAssignment VisitColumnAssignment(DbColumnAssignment ca)
        {
            ca = base.VisitColumnAssignment(ca);
            Expression             expression = ca.Expression;
            DbNamedValueExpression nv         = expression as DbNamedValueExpression;

            if (nv != null)
            {
                expression = new DbNamedValueExpression(nv.Name, ca.Column.DbType, nv.Value);
            }
            return(this.UpdateColumnAssignment(ca, ca.Column, expression));
        }
 protected DbColumnAssignment UpdateColumnAssignment(
     DbColumnAssignment ca, DbColumnExpression c, Expression e)
 {
     if (c != ca.Column || e != ca.Expression)
         return new DbColumnAssignment(c, e);
     
     return ca;
 }
 protected virtual DbColumnAssignment VisitColumnAssignment(DbColumnAssignment ca)
 {
     DbColumnExpression c = (DbColumnExpression)Visit(ca.Column);
     Expression e = Visit(ca.Expression);
     return UpdateColumnAssignment(ca, c, e);
 }