Entity Developer for Entity Framework supports the use of enum types in models starting with Entity Framework 5.0, i.e. .NET Framework 4.5 must be installed.
Enumerated type is a distinct type that consists of a set of named constants. The Entity Framework enum type definitions reside in the conceptual layer. The enum type has an underlying type (which can be SByte, Byte, Int16, Int32, or Int64; Int32 is used as the default underlying type if none has been specified).
Enumerated types can have zero or more members. A defined member must have a unique name (note that names are case-sensitive) and may have a value. If the value for the member is not specified, then the value is calculated based on the value of the previous member (through incrementing by one) or set to 0 if there is no previous member. If the value for a given member is specified, it must be in the range of its enum underlying type. Values can be specified only for some of the members; several members can have the same value.
Note also that, when Updating Database from Model is performed within the Model-First approach, for an entity with a property whose type is set to Enum, the type of the corresponding column that is created in the database is assigned based on the underlying type of the enum.
To add a new enum type to a model and to display it on the diagram surface, perform the following sequence of actions:
The Enum Type Editor dialog box is displayed:
The newly created enum type is displayed in the Enum Types node of the Model Explorer window. If needed, drag it to the diagram area. |
To add a member of an existing enum type, perform the following sequence of actions:
A new member with default properties is added to the selected enum type. |
To modify a member of an existing enum type, perform the following sequence of actions:
The selected enum type is successfully modified. |
To delete an existing enum type use one of the following options:
Entity Developer will then ask you whether you want to delete the object from the model too. If the enum type being deleted is assigned as the type of a property of an entity in the model, after the standard confirmation dialog the following warning is displayed:
Using this dialog, select the appropriate action. |
Entity Developer can work with external enums. These are enums that are already defined in your project, and they should not be generated by Entity Developer. For such enums you may omit member definition. When you specify their name, you need to enter the full name including the namespace, containing the enum. To define an enum as external, select the Is External check box in its editor or set its Is External property value to True in the Properties window. |