示例#1
0
 /// <summary>
 /// Inserts new record into table, identified by T mapping class, using values from obj parameter or update existing record, identified by match on primary key value.
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="obj"></param>
 /// <param name="tableName"></param>
 /// <param name="databaseName"></param>
 /// <param name="schemaName"></param>
 /// <param name="serverName"></param>
 /// <param name="tableOptions"></param>
 /// <returns></returns>
 public int InsertOrReplace <T>(IEnumerable <T> obj, string tableName = null, string databaseName = null, string schemaName = null, string serverName = null, TableOptions tableOptions = TableOptions.NotSet) => ForEach(obj, item => DataExtensions.InsertOrReplace(this, item, tableName, databaseName, schemaName, serverName, tableOptions));
示例#2
0
 /// <summary>
 /// Asynchronously inserts new record into table, identified by T mapping class, using values from obj parameter or update existing record, identified by match on primary key value.
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="obj"></param>
 /// <param name="tableName"></param>
 /// <param name="databaseName"></param>
 /// <param name="schemaName"></param>
 /// <param name="serverName"></param>
 /// <param name="tableOptions"></param>
 /// <param name="token"></param>
 /// <returns></returns>
 public async ValueTask <int> InsertOrReplaceAsync <T>(IEnumerable <T> obj, string tableName = null, string databaseName = null, string schemaName = null, string serverName = null, TableOptions tableOptions = TableOptions.NotSet, CancellationToken token = default) => await ForEach(obj, item => DataExtensions.InsertOrReplaceAsync(this, item, tableName, databaseName, schemaName, serverName, tableOptions, token));
示例#3
0
 /// <summary>
 /// Updates record in table, identified by T mapping class, using values from obj parameter. Record to update identified by match on primary key value from obj value.
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="obj"></param>
 /// <returns></returns>
 public int Update <T>(IEnumerable <T> obj) => ForEach(obj, item => DataExtensions.Update(this, item));
示例#4
0
 /// <summary>
 /// Asynchronously updates record in table, identified by T mapping class, using values from obj parameter. Record to update identified by match on primary key value from obj value.
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="obj"></param>
 /// <returns></returns>
 public async ValueTask <int> UpdateAsync <T>(IEnumerable <T> obj) => await ForEach(obj, item => DataExtensions.UpdateAsync(this, item));
示例#5
0
 public int Save <T>(T obj)
 {
     return(this.ExecutePack(() => DataExtensions.Insert(this, obj)));
 }
示例#6
0
 public int SaveWithInt32Identity <T>(T obj)
 {
     return(this.ExecutePack(() => DataExtensions.InsertWithInt32Identity(this, obj)));
 }
示例#7
0
 public int Save <T>(System.Collections.Generic.IEnumerable <T> obj) => this.ExecutePack(() => ForEach(obj, item => DataExtensions.Insert(this, item)));
示例#8
0
 public int Delete <T>(T obj)
 {
     return(this.ExecutePack(() => DataExtensions.Delete(this, obj)));
 }
示例#9
0
 public int Delete <T>(System.Collections.Generic.IEnumerable <T> obj)
 {
     return(this.ExecutePack(() => ForEach(obj, item => DataExtensions.Delete(this, item))));
 }
示例#10
0
 public int SaveOrUpdate <T>(T obj)
 {
     return(this.ExecutePack(() => DataExtensions.InsertOrReplace(this, obj)));
 }
示例#11
0
 public int SaveOrUpdate <T>(System.Collections.Generic.IEnumerable <T> obj)
 {
     return(this.ExecutePack(() => ForEach(obj, item => DataExtensions.InsertOrReplace(this, item))));
 }