From 407de9638deaf9d03fb12cb4c851d24462a3842e Mon Sep 17 00:00:00 2001 From: sunkaixuan <610262374@qq.com> Date: Thu, 1 Dec 2022 00:21:56 +0800 Subject: [PATCH] Update Storageable --- .../Abstract/SugarProvider/SqlSugarProvider.cs | 12 ++++++++++++ .../Abstract/SugarProvider/SqlSugarScopeProvider.cs | 8 ++++++++ Src/Asp.Net/SqlSugar/Interface/ISqlSugarClient.cs | 2 ++ Src/Asp.Net/SqlSugar/SqlSugarScope.cs | 9 ++++++++- 4 files changed, 30 insertions(+), 1 deletion(-) diff --git a/Src/Asp.Net/SqlSugar/Abstract/SugarProvider/SqlSugarProvider.cs b/Src/Asp.Net/SqlSugar/Abstract/SugarProvider/SqlSugarProvider.cs index b74f06668..3e6ce1b8c 100644 --- a/Src/Asp.Net/SqlSugar/Abstract/SugarProvider/SqlSugarProvider.cs +++ b/Src/Asp.Net/SqlSugar/Abstract/SugarProvider/SqlSugarProvider.cs @@ -833,6 +833,18 @@ namespace SqlSugar { return new SaveableProvider(this, saveObject); } + public StorageableDataTable Storageable(List> dictionaryList, string tableName) + { + DataTable dt = this.Context.Utilities.DictionaryListToDataTable(dictionaryList); + dt.TableName = tableName; + return this.Context.Storageable(dt); + } + public StorageableDataTable Storageable(Dictionary dictionary, string tableName) + { + DataTable dt = this.Context.Utilities.DictionaryListToDataTable(new List>() { dictionary }); + dt.TableName = tableName; + return this.Context.Storageable(dt); + } public IStorageable Storageable(List dataList) where T : class, new() { this.InitMappingInfo(); diff --git a/Src/Asp.Net/SqlSugar/Abstract/SugarProvider/SqlSugarScopeProvider.cs b/Src/Asp.Net/SqlSugar/Abstract/SugarProvider/SqlSugarScopeProvider.cs index d1c995ee3..8231e8b32 100644 --- a/Src/Asp.Net/SqlSugar/Abstract/SugarProvider/SqlSugarScopeProvider.cs +++ b/Src/Asp.Net/SqlSugar/Abstract/SugarProvider/SqlSugarScopeProvider.cs @@ -566,6 +566,14 @@ namespace SqlSugar { return ScopedContext.SqlQueryable(sql); } + public StorageableDataTable Storageable(List> dictionaryList, string tableName) + { + return ScopedContext.Storageable(dictionaryList, tableName); + } + public StorageableDataTable Storageable(Dictionary dictionary, string tableName) + { + return ScopedContext.Storageable(dictionary, tableName); + } public IStorageable Storageable(List dataList) where T : class, new() { diff --git a/Src/Asp.Net/SqlSugar/Interface/ISqlSugarClient.cs b/Src/Asp.Net/SqlSugar/Interface/ISqlSugarClient.cs index 4022cc367..0cd98a8e3 100644 --- a/Src/Asp.Net/SqlSugar/Interface/ISqlSugarClient.cs +++ b/Src/Asp.Net/SqlSugar/Interface/ISqlSugarClient.cs @@ -137,6 +137,8 @@ namespace SqlSugar #endregion #region Saveable + StorageableDataTable Storageable(List> dictionaryList, string tableName); + StorageableDataTable Storageable(Dictionary dictionary, string tableName); IStorageable Storageable(List dataList) where T : class, new(); IStorageable Storageable(T data) where T : class, new(); StorageableDataTable Storageable(DataTable data); diff --git a/Src/Asp.Net/SqlSugar/SqlSugarScope.cs b/Src/Asp.Net/SqlSugar/SqlSugarScope.cs index f46242b47..409668d97 100644 --- a/Src/Asp.Net/SqlSugar/SqlSugarScope.cs +++ b/Src/Asp.Net/SqlSugar/SqlSugarScope.cs @@ -569,7 +569,14 @@ namespace SqlSugar { return ScopedContext.SqlQueryable(sql); } - + public StorageableDataTable Storageable(List> dictionaryList, string tableName) + { + return ScopedContext.Storageable(dictionaryList, tableName); + } + public StorageableDataTable Storageable(Dictionary dictionary, string tableName) + { + return ScopedContext.Storageable(dictionary, tableName); + } public IStorageable Storageable(List dataList) where T : class, new() { return ScopedContext.Storageable(dataList);