mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-08-24 07:07:23 +08:00
Synchronization code
This commit is contained in:
parent
88733d4413
commit
f7f197359e
@ -2,7 +2,7 @@
|
||||
<package >
|
||||
<metadata>
|
||||
<id>SqlSugar</id>
|
||||
<version>5.1.4.141</version>
|
||||
<version>5.1.4.142-preview10</version>
|
||||
<title>.Net Framework 安装此版本, 5.0.3.3-max 最低要求 .Net Framework 4.6 | 5.0.0.2-5.0.3.2 最低要求 .Net Framework 4.5 | 4.0-4.9.11 最低要求 .Net Framework 4.0+ .NET ORM </title>
|
||||
<authors>sun kaixuan</authors>
|
||||
<owners>landa</owners>
|
||||
|
@ -78,9 +78,9 @@ namespace SqlSugar
|
||||
{
|
||||
if (this.Context?.CurrentConnectionConfig?.MoreSettings?.IsCorrectErrorSqlParameterName == true)
|
||||
{
|
||||
foreach (var item in dictionary)
|
||||
foreach (DataRow item in dt.Rows)
|
||||
{
|
||||
cmd.CommandText = this.Context.Insertable(item).AS(dt.TableName).ToSqlString().Replace(";SELECT LAST_INSERT_ROWID();", "");
|
||||
cmd.CommandText = this.Context.Insertable(UtilMethods.DataRowToDictionary(item)).AS(dt.TableName).ToSqlString().Replace(";SELECT LAST_INSERT_ROWID();", "");
|
||||
i += await cmd.ExecuteNonQueryAsync();
|
||||
}
|
||||
}
|
||||
@ -117,9 +117,9 @@ namespace SqlSugar
|
||||
{
|
||||
if (this.Context?.CurrentConnectionConfig?.MoreSettings?.IsCorrectErrorSqlParameterName == true)
|
||||
{
|
||||
foreach (var item in dictionary)
|
||||
foreach (DataRow item in dt.Rows)
|
||||
{
|
||||
cmd.CommandText = this.Context.Updateable(item)
|
||||
cmd.CommandText = this.Context.Updateable(UtilMethods.DataRowToDictionary(item))
|
||||
.WhereColumns(whereColums)
|
||||
.UpdateColumns(updateColums)
|
||||
.AS(dt.TableName).ToSqlString();
|
||||
|
@ -18,7 +18,18 @@ namespace SqlSugar
|
||||
{
|
||||
public class UtilMethods
|
||||
{
|
||||
public static Dictionary<string, object> DataRowToDictionary(DataRow row)
|
||||
{
|
||||
Dictionary<string, object> dictionary = new Dictionary<string, object>();
|
||||
|
||||
// 遍历所有列并将其添加到字典中
|
||||
foreach (DataColumn column in row.Table.Columns)
|
||||
{
|
||||
dictionary.Add(column.ColumnName, row[column]);
|
||||
}
|
||||
|
||||
return dictionary;
|
||||
}
|
||||
public static IEnumerable<T> BuildTree<T>(ISqlSugarClient db,IEnumerable<T> list, string idName, string pIdName, string childName, object rootValue)
|
||||
{
|
||||
var entityInfo = db.EntityMaintenance.GetEntityInfo<T>(); ;
|
||||
|
Loading…
Reference in New Issue
Block a user