Пример #1
0
        protected virtual Expression VisitInsert(DbInsertCommand insert)
        {
            var table       = this.Visit(insert.Table) as DbTableExpression;
            var assignments = this.VisitColumnAssignments(insert.Assignments);

            return(this.UpdateInsert(insert, table, assignments));
        }
Пример #2
0
        protected DbInsertCommand UpdateInsert(DbInsertCommand insert, DbTableExpression table, IEnumerable <DbColumnAssignment> assignments)
        {
            if (table != insert.Table || assignments != insert.Assignments)
            {
                return(new DbInsertCommand(table, assignments));
            }

            return(insert);
        }
Пример #3
0
        protected override Expression VisitInsert(DbInsertCommand insert)
        {
            this.Write("INSERT INTO ");
            this.WriteTableName(insert.Table.Name);
            this.Write("(");

            for (int i = 0, n = insert.Assignments.Count; i < n; i++)
            {
                var ca = insert.Assignments[i];

                if (i > 0)
                {
                    this.Write(", ");
                }

                this.WriteColumnName(ca.Column.Name);
            }

            this.Write(")");
            this.WriteLine(Indentation.Same);
            this.Write("VALUES (");

            for (int i = 0, n = insert.Assignments.Count; i < n; i++)
            {
                var ca = insert.Assignments[i];

                if (i > 0)
                {
                    this.Write(", ");
                }

                this.Visit(ca.Expression);
            }

            this.Write(")");

            return(insert);
        }
 protected virtual bool CompareInsert(DbInsertCommand x, DbInsertCommand y)
 {
     return(this.Compare(x.Table, y.Table) && this.CompareColumnAssignments(x.Assignments, y.Assignments));
 }
Пример #5
0
 protected override Expression VisitInsert(DbInsertCommand insert)
 {
     return(this.BuildExecuteCommand(insert));
 }