自定义枚举类型转换出错 返回
SqlSugar
沟通中
3
239
悬赏:0 飞吻
[SugarTable]
public class Test
{
[SugarColumn(IsPrimaryKey =true)]
public int Id { get; set; }
[SugarColumn(IsPrimaryKey = true,SqlParameterDbType = typeof(EnumToStringConvert))]
public MyType Type { get; set; }
public string? Name { get; set; }
}
public enum MyType
{
Type1, Type2
}
var test = new Test()
{
Id = 1,
Type = MyType.Type1,
Name = "3"
};
client.Deleteable<Test>().ExecuteCommand();
client.Storageable(test).ExecuteCommand();
client.Storageable(test).ExecuteCommand();
Console.WriteLine("OK");代码如上,在第二次调用Storageable的时候,此时应该执行的是update操作,这个时候报数据类型转换失败,如下图

热忱回答(3)
-
fate sta VIP0
2025/11/18我处理一下。
0 回复 -
fate stay night VIP0
2025/11/19SqlSugarCore 5.1.4.209-preview02
过五分钟后安装预览版本 209 ,已修复,预览
0 回复 -
Coder VIP0
2025/11/21
0 回复