Beispiel #1
0
        public InsertStatement CreateStatement(DatabaseMapper mapper)
        {
            var insert = new InsertStatement();

            insert.Target = new Table(mapper.GetTableName(this.Target));
            insert.SetValues.AddRange(this.SetValues.Select(sv => new SetValue(new Column(mapper.GetColumnName(sv.Item1)), sv.Item2)));
            return(insert);
        }
Beispiel #2
0
        public override Statement CreateStatement(DatabaseMapper mapper)
        {
            var insert = new InsertStatement();

            insert.Target = new Table(mapper.GetTableName(this.Target));
            insert.SetValues.AddRange(this.SetValues.Select(sv => PropertyToSetValue(sv, mapper)));
            return(insert);
        }
Beispiel #3
0
 public static InsertStatement <T> Value <T>(this InsertStatement <T> insert, Expression <Func <T, object> > property, object value)
 {
     insert.SetValues.Add(new Tuple <PropertyInfo, object>(FuncToPropertyInfo(property), value));
     return(insert);
 }
 /// <summary>
 /// Adds a select statement to insert with to the statement (used in conjunction with Columns).
 /// </summary>
 /// <param name="insert">The insert statement.</param>
 /// <param name="statement">The statement.</param>
 /// <returns>The insert statement.</returns>
 public static InsertStatement Select(this InsertStatement insert, SelectStatement statement)
 {
     insert.Source = statement;
     return(insert);
 }
 /// <summary>
 /// Adds a list of columns to insert with the statement (used in conjuction with Select).
 /// </summary>
 /// <param name="insert">The insert statement.</param>
 /// <param name="columnNames">The column names.</param>
 /// <returns>The insert statement.</returns>
 public static InsertStatement Columns(this InsertStatement insert, params string[] columnNames)
 {
     insert.TargetFields.AddRange(columnNames.Select(cn => new Column(cn)));
     return(insert);
 }
 /// <summary>
 /// Adds a value to insert with the statement.
 /// </summary>
 /// <param name="insert">The insert statement.</param>
 /// <param name="columnName">Name of the column.</param>
 /// <param name="value">The value.</param>
 /// <returns>The insert statement.</returns>
 public static InsertStatement Value(this InsertStatement insert, string columnName, object value)
 {
     insert.SetValues.Add(new SetValue(columnName, value));
     return(insert);
 }