Visual Studio and .NET Framework Home
Thank you for your feedback!
Entity Framework should support mapping to Enum
- by jods
This item may be valid but belongs to an external system out of the direct control of this product team.
A more detailed explanation for the resolution of this particular item may have been provided in the comments section.
9/2/2008 9:04:01 AM
I think the title says it all. Linq to SQL supports this already, and it's useful.
ATTACH A FILE
EDIT THIS ITEM
Item can only be reassigned when it is active.
to post a comment.
Please enter a comment.
on 9/22/2011 at 7:58 AM
From the Code First approach, the EF Designer should generate a "look up table" with the name of the look up table being the name of the property, and the look up table should have at least Id and Name columns. Inverserly, from the Database First approach, an Enum should be generated from a look up table, perhaps only when adhering to a specific schema where the Enum names are derived from the Name column and the Enum values come from the Id column which in most cases will be Primary Keys and an Incremental Identity Integer field.
on 7/4/2011 at 6:07 AM
The ADO.NET team released the June 2011 CTP recently, which now includes full support for enums in the model and the designer (wahoo!!!). See the following blog post:
on 2/10/2011 at 5:14 AM
I'm new to EF4. Is the workaround valid for designer-driven models?
on 2/8/2011 at 2:23 PM
EF really should support this feature. Very annoying when migrating from an ORM which does do enums (all the major ORMs I think) to EF4.
on 10/4/2010 at 2:16 AM
Anyone who feels this is important, the data team also have an external voting site where they're trying to prioritize feature requests. It might be worth getting your votes in there too. Enum mapping is currently the #1 request:
on 9/8/2010 at 9:42 PM
I have officially just had my mind blown clean out the water. An ORM that doesn't support enums is an ORM still in development. Please change the status of Entity Framework from "Released" to "Still in development", and communicate to all Visual Studio owners that they should stop using EF until development is completed.
on 8/16/2010 at 3:47 PM
+1 for this feature.
A somewhat hacky workaround is described here:
on 6/28/2010 at 11:49 PM
Don't want to repeat myself
This feature is forcing me to choose nhibernate for my next project. :@
Michael T. Bunney
on 4/27/2010 at 4:48 PM
The cited workaround doesn't really solve the problem, because you can't use the pseudo-enum in LINQ queries. Entity Framework needs real enum support like that already in LINQ to SQL.
on 2/11/2010 at 1:48 PM
I understand the arguments against, but we need to be able to choose!
on 1/10/2010 at 1:30 PM
It's definitely a MUST HAVE for us. I would like to see the same support as in LINQ to SQL, where enum can also be mapped to strings or ints.
on 9/8/2009 at 2:02 AM
It's really disappointing that enum support likely isn't going to make it into the VS2010/.NET 4.0. It's one of the last remaining adoption barriers for me, so it's a bit of a let down that we'll likely have to wait a couple of years after the 2010 release before this is addressed.
In fact, enum support is such a key scenario, I'd be more than happy for the entire VS2010 product release to be delayed in order to fit this feature in.
on 12/22/2008 at 2:58 PM
I'd really like to see this added.
In our database design, we have a number of "type" tables that map directly to enumerations in the business logic layer. The tables exist purely for database integrity - ensuring the values are within a valid range.
With v1.0 of the entity framework, I can't model this pattern:
* The entity framework forces me to use a "navigation property" to the type table due to the foreign key
* The entity framework does not allow me to have a "shortcut" property (even if settable = private) letting me set the type directly at the same time as having a navigation property
* The entity framework does not support enumerations.
At this point, I'm SOL. The entity framework has completely failed me, and I'm forced to abandon it.
on 9/25/2008 at 9:49 AM
Thank you for reporting this issue. We will look at addressing this in the next release.
Entity Designer Team
to post a workaround.
Please enter a workaround.
on 1/11/2010 at 8:35 AM
Attach a file
© 2017 Microsoft