This might sound repeated but I have gone through all the available posts but could not figure out the best method in EF 6 version.
I have two tables
PersonPhone (PersonID, PhoneTypeID) PhoneType(PhoneTypeID, Description)
PhoneTypes as just look ups (Cell, Office, Pager etc). How do I generate equivalent Enums in code from PhoneType table.
Can anyone please provide steps to generate ENums from Look up tables? Thanks in advance
One way is with a T4 Template that will automatically generate your Enum's from the table.
Here is a great template that I've used in a couple projects. Just change the connection string, and make sure the scripts assumptions about the format of your data are correct (i.e. that the id's are named
TableNameID). Then add in the appropriate .tt files for each Enum, and run the template.