From 4d55dace2300ddb472fa917d9395f45cee66b6f1 Mon Sep 17 00:00:00 2001 From: sunkaixuan <610262374@qq.com> Date: Mon, 30 May 2022 15:27:41 +0800 Subject: [PATCH] SugarParameter init type --- .../ExpressionsToSql/Common/SugarParameter.cs | 12 ++++++++++++ Src/Asp.NetCore2/SqlSugar/Utilities/UtilConstants.cs | 3 +++ 2 files changed, 15 insertions(+) diff --git a/Src/Asp.NetCore2/SqlSugar/ExpressionsToSql/Common/SugarParameter.cs b/Src/Asp.NetCore2/SqlSugar/ExpressionsToSql/Common/SugarParameter.cs index 4a130ab10..0e6baeb18 100644 --- a/Src/Asp.NetCore2/SqlSugar/ExpressionsToSql/Common/SugarParameter.cs +++ b/Src/Asp.NetCore2/SqlSugar/ExpressionsToSql/Common/SugarParameter.cs @@ -138,6 +138,18 @@ namespace SqlSugar this.DbType = System.Data.DbType.Int64; this.Value = Convert.ToInt64(Value); } + else if (type==UtilConstants.UIntType) + { + this.DbType = System.Data.DbType.UInt32; + } + else if (type == UtilConstants.ULongType) + { + this.DbType = System.Data.DbType.UInt64; + } + else if (type == UtilConstants.ShortType) + { + this.DbType = System.Data.DbType.UInt16; + } } public SugarParameter(string name, object value, bool isOutput) diff --git a/Src/Asp.NetCore2/SqlSugar/Utilities/UtilConstants.cs b/Src/Asp.NetCore2/SqlSugar/Utilities/UtilConstants.cs index ea751c3b4..6387f7f01 100644 --- a/Src/Asp.NetCore2/SqlSugar/Utilities/UtilConstants.cs +++ b/Src/Asp.NetCore2/SqlSugar/Utilities/UtilConstants.cs @@ -15,6 +15,9 @@ namespace SqlSugar internal const string ReplaceKey = "{662E689B-17A1-4D06-9D27-F29EAB8BC3D6}"; internal const string ReplaceCommaKey = "{112A689B-17A1-4A06-9D27-A39EAB8BC3D5}"; + internal static Type UShortType = typeof(ushort); + internal static Type ULongType = typeof(ulong); + internal static Type UIntType = typeof(uint); internal static Type IntType = typeof(int); internal static Type LongType = typeof(long); internal static Type GuidType = typeof(Guid);