From 5f222f57eb0925a28b5a5c0eb23f334256c2ce91 Mon Sep 17 00:00:00 2001 From: skx <610262374@qq.com> Date: Tue, 29 Dec 2020 21:32:18 +0800 Subject: [PATCH] - --- Src/Asp.Net/PgSqlTest/Config.cs | 6 +++--- Src/Asp.Net/PgSqlTest/Demo/Demo2_Updateable.cs | 5 ++++- .../SqlSugar/ExpressionsToSql/Common/SugarParameter.cs | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Src/Asp.Net/PgSqlTest/Config.cs b/Src/Asp.Net/PgSqlTest/Config.cs index c8c29c8d8..4f718ae16 100644 --- a/Src/Asp.Net/PgSqlTest/Config.cs +++ b/Src/Asp.Net/PgSqlTest/Config.cs @@ -16,16 +16,16 @@ namespace OrmTest /// Account have permission to create database /// 用有建库权限的数据库账号 /// - public static string ConnectionString = "PORT=5432;DATABASE=SqlSugar4xTest;HOST=localhost;PASSWORD=haosql;USER ID=postgres"; + public static string ConnectionString = "PORT=5433;DATABASE=SqlSugar4xTest;HOST=localhost;PASSWORD=haosql;USER ID=postgres"; /// /// Account have permission to create database /// 用有建库权限的数据库账号 /// - public static string ConnectionString2 = "PORT=5432;DATABASE=SqlSugar4xTest2;HOST=localhost;PASSWORD=haosql;USER ID=postgres"; + public static string ConnectionString2 = "PORT=5433;DATABASE=SqlSugar4xTest2;HOST=localhost;PASSWORD=haosql;USER ID=postgres"; /// /// Account have permission to create database /// 用有建库权限的数据库账号 /// - public static string ConnectionString3 = "PORT=5432;DATABASE=SqlSugar4xTest3;HOST=localhost;PASSWORD=haosql;USER ID=postgres"; + public static string ConnectionString3 = "PORT=5433;DATABASE=SqlSugar4xTest3;HOST=localhost;PASSWORD=haosql;USER ID=postgres"; } } diff --git a/Src/Asp.Net/PgSqlTest/Demo/Demo2_Updateable.cs b/Src/Asp.Net/PgSqlTest/Demo/Demo2_Updateable.cs index 60a5ce9d7..25c6f4e8b 100644 --- a/Src/Asp.Net/PgSqlTest/Demo/Demo2_Updateable.cs +++ b/Src/Asp.Net/PgSqlTest/Demo/Demo2_Updateable.cs @@ -64,7 +64,10 @@ namespace OrmTest var result71 = db.Updateable().SetColumns(it => new Order() { Name = "a", CreateTime = DateTime.Now }).Where(it => it.Id == 11).ExecuteCommand(); //only update name var result8 = db.Updateable(it => it.Name == "Name").Where(it => it.Id == 1).ExecuteCommand(); - var result81 = db.Updateable().SetColumns(it => it.Name == "Name" ).Where(it => it.Id == 1).ExecuteCommand(); + var result81 = db.Updateable() + .SetColumns(it => it.Name == "Name" ) + .SetColumns(it => it.CreateTime == DateTime.Now) + .Where(it => it.Id == 1).ExecuteCommand(); // diff --git a/Src/Asp.Net/SqlSugar/ExpressionsToSql/Common/SugarParameter.cs b/Src/Asp.Net/SqlSugar/ExpressionsToSql/Common/SugarParameter.cs index 02068ecc3..f654da37e 100644 --- a/Src/Asp.Net/SqlSugar/ExpressionsToSql/Common/SugarParameter.cs +++ b/Src/Asp.Net/SqlSugar/ExpressionsToSql/Common/SugarParameter.cs @@ -129,7 +129,7 @@ namespace SqlSugar if (this.Value != null) this.Value = this.Value.ToString(); } - else if (type.IsEnum()) + else if (type!=null&&type.IsEnum()) { this.DbType = System.Data.DbType.Int64; }