Add: db.Storageabl(data).ExecuteSqlBulkCopy()

This commit is contained in:
sunkaixuan
2023-03-25 11:18:33 +08:00
parent 8945815a4e
commit d042fce5e7
2 changed files with 12 additions and 0 deletions

View File

@@ -107,6 +107,16 @@ namespace SqlSugar
result +=await x.AsUpdateable.ExecuteCommandAsync();
return result;
}
public int ExecuteSqlBulkCopy()
{
var storage = this.ToStorage();
return storage.BulkCopy() + storage.BulkUpdate();
}
public async Task<int> ExecuteSqlBulkCopyAsync()
{
var storage =await this.ToStorageAsync();
return await storage.BulkCopyAsync() + await storage.BulkUpdateAsync();
}
public StorageableResult<T> ToStorage()
{
if (whereFuncs == null || whereFuncs.Count == 0)

View File

@@ -27,6 +27,8 @@ namespace SqlSugar
IStorageable<T> As(string tableName);
int ExecuteCommand();
Task<int> ExecuteCommandAsync();
int ExecuteSqlBulkCopy();
Task<int> ExecuteSqlBulkCopyAsync();
}
public class StorageableInfo<T> where T : class, new()