Support for database enums
See original GitHub issuePostgreSQL allows defining enums as first-class database types, which can then be used in regular columns. Npgsql exposes this by allowing users to define a mapping between a PostgreSQL enum and a CLR enum.
EF7’s type mapping now allows arbitrary types to be mapped to supported database types, this works very well with PostgreSQL types - types such as macaddr
are successfully mapped in EF7 to .NET PhysicalAddress. However, when trying to add enum mapping support I ran into trouble - it seems that in various areas of the EF7 core enums are unwrapped and treated as their underlying numeric type instead (e.g. int).
I’m guessing this is to allow enums to be saved to numeric columns for databases which don’t support enums natively (e.g. SqlServer). Am I understanding the situation correctly, is database enum support currently impossible in EF7?
Issue Analytics
- State:
- Created 8 years ago
- Reactions:16
- Comments:14 (5 by maintainers)
Top GitHub Comments
@CoffeeDreamLabs I believe that the updates to the type mapper in 2.1 should allow the Postgres driver to support this starting in 2.1. /cc @roji
We will look at it again post v1.0.0