diff --git a/Src/Asp.NetCore2/SqlSugar/Realization/Kdbndp/CodeFirst/KdbndpCodeFirst.cs b/Src/Asp.NetCore2/SqlSugar/Realization/Kdbndp/CodeFirst/KdbndpCodeFirst.cs index 1c96fd564..94da7ffae 100644 --- a/Src/Asp.NetCore2/SqlSugar/Realization/Kdbndp/CodeFirst/KdbndpCodeFirst.cs +++ b/Src/Asp.NetCore2/SqlSugar/Realization/Kdbndp/CodeFirst/KdbndpCodeFirst.cs @@ -76,6 +76,11 @@ namespace SqlSugar { item.Length = 0; } + if (IsSqlServerModel()&&item.DataType == "bytea") + { + item.Length = 0; + item.DataType = "varbinary(max)"; + } } } diff --git a/Src/Asp.NetCore2/SqlSugar/Realization/Kdbndp/DbMaintenance/KdbndpDbMaintenance.cs b/Src/Asp.NetCore2/SqlSugar/Realization/Kdbndp/DbMaintenance/KdbndpDbMaintenance.cs index 5d21d4cc4..db3e2f20b 100644 --- a/Src/Asp.NetCore2/SqlSugar/Realization/Kdbndp/DbMaintenance/KdbndpDbMaintenance.cs +++ b/Src/Asp.NetCore2/SqlSugar/Realization/Kdbndp/DbMaintenance/KdbndpDbMaintenance.cs @@ -743,6 +743,11 @@ WHERE tgrelid = '" + tableName + "'::regclass"); x.Scale = 0; } } + if (IsSqlServerModel() && x.DataType == "bytea") + { + x.Length = 0; + x.DataType = "varbinary(max)"; + } } private bool IsPgModel() { diff --git a/Src/Asp.NetCore2/SqlSugar/Realization/Kdbndp/SqlBuilder/KdbndpInsertBuilder.cs b/Src/Asp.NetCore2/SqlSugar/Realization/Kdbndp/SqlBuilder/KdbndpInsertBuilder.cs index 887e21e1c..a5145b493 100644 --- a/Src/Asp.NetCore2/SqlSugar/Realization/Kdbndp/SqlBuilder/KdbndpInsertBuilder.cs +++ b/Src/Asp.NetCore2/SqlSugar/Realization/Kdbndp/SqlBuilder/KdbndpInsertBuilder.cs @@ -93,7 +93,12 @@ namespace SqlSugar else if (it.Value is bool&& (IsMySqlModel()|| IsSqlServerModel())) { return Convert.ToBoolean(it.Value)?"1":"0"; - } + } + else if (it.Value is byte[] bytes) + { + string bytesString = "0x" + BitConverter.ToString(bytes).Replace("-", ""); + return bytesString; + } else { value = it.Value; diff --git a/Src/Asp.NetCore2/SqlSugar/SqlSugarForCore.nuspec b/Src/Asp.NetCore2/SqlSugar/SqlSugarForCore.nuspec index 83d94a647..26ce552f1 100644 --- a/Src/Asp.NetCore2/SqlSugar/SqlSugarForCore.nuspec +++ b/Src/Asp.NetCore2/SqlSugar/SqlSugarForCore.nuspec @@ -2,7 +2,7 @@ SqlSugarCore - 5.1.4.210 + 5.1.4.211-preview03 sunkaixuan 果糖大数据科技 http://www.apache.org/licenses/LICENSE-2.0.html