diff --git a/Src/Asp.NetCore2/SqlSugar/Abstract/QueryableProvider/MappingFieldsHelper.cs b/Src/Asp.NetCore2/SqlSugar/Abstract/QueryableProvider/MappingFieldsHelper.cs index 2263ff724..5fed9d2c1 100644 --- a/Src/Asp.NetCore2/SqlSugar/Abstract/QueryableProvider/MappingFieldsHelper.cs +++ b/Src/Asp.NetCore2/SqlSugar/Abstract/QueryableProvider/MappingFieldsHelper.cs @@ -44,7 +44,7 @@ namespace SqlSugar FieldName = item.LeftEntityColumn.DbColumnName, ConditionalType = ConditionalType.Equal, FieldValue = item.RightEntityColumn.PropertyInfo.GetValue(model).ObjToString(), - CSharpTypeName = item.RightEntityColumn.PropertyInfo.PropertyType.Name + CSharpTypeName =UtilMethods.GetUnderType(item.RightEntityColumn.PropertyInfo.PropertyType).Name })); i++; } diff --git a/Src/Asp.NetCore2/SqlSugar/Utilities/UtilMethods.cs b/Src/Asp.NetCore2/SqlSugar/Utilities/UtilMethods.cs index 6063ff3d6..f53344a61 100644 --- a/Src/Asp.NetCore2/SqlSugar/Utilities/UtilMethods.cs +++ b/Src/Asp.NetCore2/SqlSugar/Utilities/UtilMethods.cs @@ -782,6 +782,10 @@ namespace SqlSugar CSharpTypeName = ctypename, FieldValue = value }; + if (item.FieldValue == string.Empty && item.CSharpTypeName.HasValue() && !item.CSharpTypeName.EqualCase("string")) + { + return null; + } if (item.CSharpTypeName.EqualCase(UtilConstants.DecType.Name)) { return Convert.ToDecimal(item.FieldValue);