如何在实体框架中删除转换枚举类型

时间:2022-08-27 16:10:40

how can I remove casting to int for enum types in sql generator?

如何在sql生成器中为enum类型删除转换为int?

WHERE (1 = CAST( [Extent1].[MyEnumType] AS int))

WHERE(1 = CAST([Extent1]。[MyEnumType] AS int))

I need to have just

我需要有

WHERE (1 = MyEnumType)

WHERE(1 = MyEnumType)

I tried to add [Column[TypeName="int"]] to property but without effect.

我试图将[Column [TypeName =“int”]]添加到属性但没有效果。

1 个解决方案

#1


This seems to be fixed in Entity Framework 6.1.2. Please see https://entityframework.codeplex.com/workitem/186. I was able to verify that the upgrade from 6.1.1 to 6.1.3 fixed this very problem for us.

这似乎在实体框架6.1.2中得到修复。请参阅https://entityframework.codeplex.com/workitem/186。我能够验证从6.1.1升级到6.1.3为我们解决了这个问题。

#1


This seems to be fixed in Entity Framework 6.1.2. Please see https://entityframework.codeplex.com/workitem/186. I was able to verify that the upgrade from 6.1.1 to 6.1.3 fixed this very problem for us.

这似乎在实体框架6.1.2中得到修复。请参阅https://entityframework.codeplex.com/workitem/186。我能够验证从6.1.1升级到6.1.3为我们解决了这个问题。