How can I make EF Core database first use Enums?

后端 未结 7 945
灰色年华
灰色年华 2020-12-06 04:43

I\'m using EF Core with database-first approach using the \"Scaffold-DbContext\"-command to generate my DbContext / Entities.

How can I instruct Scaffold-DbContext t

相关标签:
7条回答
  • 2020-12-06 05:19

    Starting with Entity Framework Core 2.1, EF supports Value Conversions to specifically address scenarios where a property needs to be mapped to a different type for storage.

    Specifically for Enums, you can use the provided EnumToStringConverter or EnumToNumberConverter.

    0 讨论(0)
提交回复
热议问题