Exemplo n.º 1
0
        public static long Update(this IDAC dac, DataRow row)
        {
            var allColumns =
                row
                .Table
                .Columns
                .Cast <DataColumn>()
                .Select(c => new ColumnValue(c.ColumnName, row[c.ColumnName]));

            var pkCols =
                row
                .Table
                .PrimaryKey
                .Select(c => new ColumnValue(c.ColumnName, row[c.ColumnName]));

            return(dac.Update(
                       row.Table.TableName,
                       allColumns.Except(pkCols),
                       pkCols
                       ));
        }
Exemplo n.º 2
0
 public static long Save(this IDAC dac, DataRow dataRow, bool ommitAutoIncrementPK = true)
 {
     using (var scope = dac.BeginScope(openConnection: true)) {
         return(dataRow.RowState == DataRowState.Added ? dac.Insert(dataRow, ommitAutoIncrementPK) : dac.Update(dataRow));
     }
 }
Exemplo n.º 3
0
 public static async Task <long> UpdateAsync(this IDAC dac, string tableName, IEnumerable <ColumnValue> setValues, IEnumerable <ColumnValue> whereValues)
 {
     return(await Task.Run(() => dac.Update(tableName, setValues, whereValues)));
 }
Exemplo n.º 4
0
 public virtual long Update(string tableName, IEnumerable <ColumnValue> setValues, IEnumerable <ColumnValue> whereValues)
 {
     return(DecoratedDAC.Update(tableName, setValues, whereValues));
 }