none
How do I add to or delete values in an enumeration if it was created by a code generator durng an EF model first workflow? RRS feed

  • Question

  • Hi,

    VS2013

    I didn't quite understand the other posts on this topic.  I would like to know the 'proper' way to change my enumeration declaration.  The enumeration was initially created following these steps:

      On the model's .edmx diagram > right click on an int32 property > Convert to Enum

    After the steps above, a nice dialogue came up to create the member names and everything works great.  But then I would like to edit the enumeration members.

    Is there a dialogue somewhere else in Visual Studio to go back and edit the enumeration members after the initial setup?  If not are we able to manually code the enumeration and still have it be used in the .emdx model instead of using that 'Convert to Enum' function?

    What's the recommended practice for this situation?  If I haven't asked the question well, please let me know.

    Thanks!

    Best Regards,

    Alan

     



    • Edited by Alan Wheeler Monday, July 7, 2014 10:11 PM clarification of question
    • Moved by Carl Cai Tuesday, July 8, 2014 2:09 AM (form vb.net)More related
    Monday, July 7, 2014 10:09 PM

Answers

  • Hi Alan;

    You should be able to modify the Enum by doing the following.

    1. Open the EDMX designer
    2. If the Model Browser window is not open right click on the design 
       surface and select Model Browser from the context menu
    3. Find the Enum Types in the and open the node.
    4. Select the Enum type you wish to modify and right click on it.
    5. In the context menu click on Edit and the dialog box will now allow 
       you to edit the Enum type.

    Don't forget to update the database.


    Fernando (MCSD)

    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.



    Tuesday, July 8, 2014 4:02 AM

All replies

  • Hi,

    I have helped you move this thread to more related forum to get better supports.

    Thanks for your understanding.

    Regards.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, July 8, 2014 2:11 AM
  • Hi Alan;

    You should be able to modify the Enum by doing the following.

    1. Open the EDMX designer
    2. If the Model Browser window is not open right click on the design 
       surface and select Model Browser from the context menu
    3. Find the Enum Types in the and open the node.
    4. Select the Enum type you wish to modify and right click on it.
    5. In the context menu click on Edit and the dialog box will now allow 
       you to edit the Enum type.

    Don't forget to update the database.


    Fernando (MCSD)

    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.



    Tuesday, July 8, 2014 4:02 AM
  • Hi Fernando,

    Thanks for your quick response and 'right on target' response.  Worked perfectly.

    Best Regards,

    Alan

    Tuesday, July 8, 2014 11:16 PM
  •   

    Not a problem Alan, glad I was able to help.

      


    Fernando (MCSD)

    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Wednesday, July 9, 2014 2:30 AM