/// <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));
/// <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));
/// <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));
/// <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));
public int Save <T>(T obj) { return(this.ExecutePack(() => DataExtensions.Insert(this, obj))); }
public int SaveWithInt32Identity <T>(T obj) { return(this.ExecutePack(() => DataExtensions.InsertWithInt32Identity(this, obj))); }
public int Save <T>(System.Collections.Generic.IEnumerable <T> obj) => this.ExecutePack(() => ForEach(obj, item => DataExtensions.Insert(this, item)));
public int Delete <T>(T obj) { return(this.ExecutePack(() => DataExtensions.Delete(this, obj))); }
public int Delete <T>(System.Collections.Generic.IEnumerable <T> obj) { return(this.ExecutePack(() => ForEach(obj, item => DataExtensions.Delete(this, item)))); }
public int SaveOrUpdate <T>(T obj) { return(this.ExecutePack(() => DataExtensions.InsertOrReplace(this, obj))); }
public int SaveOrUpdate <T>(System.Collections.Generic.IEnumerable <T> obj) { return(this.ExecutePack(() => ForEach(obj, item => DataExtensions.InsertOrReplace(this, item)))); }