diff --git a/FreeSql/Internal/CommonProvider/InsertProvider.cs b/FreeSql/Internal/CommonProvider/InsertProvider.cs index 1a1378b7..5a2b62cb 100644 --- a/FreeSql/Internal/CommonProvider/InsertProvider.cs +++ b/FreeSql/Internal/CommonProvider/InsertProvider.cs @@ -179,7 +179,7 @@ namespace FreeSql.Internal.CommonProvider } if (val == null && col.Attribute.MapType == typeof(string) && col.Attribute.IsNullable == false) col.SetValue(data, val = ""); - if (val == null && col.Attribute.MapType == typeof(byte[]) && col.Attribute.IsVersion) + if (col.Attribute.MapType == typeof(byte[]) && (val == null || (val is byte[] bytes && bytes.Length == 0)) && col.Attribute.IsVersion) col.SetValue(data, val = Utils.GuidToBytes(Guid.NewGuid())); } }