Enum "None" values - WilStead/VueCoreFramework GitHub Wiki

Standard Enums

For an enum type which does not have the FlagsAttribute applied, a "None" entry (usually set equal to 0 and called "None" or "Empty" or something similar) will be treated the same as any other selection. It will appear in the drop-down along with all the other enum values, and can be selected in the same way.

If you don't include an explicit "None" or 0 value in your enum, VueCoreFramework will not supply one, or any other way to indicate an unset value. Moreover, even if you make your enum property a Nullable VueCoreFramework will effectively ignore this. It won't cause any sort of problem or error, but the user will still not have any special way to indicate an unset value, so anytime an entry gets saved from the client front-end it will always have some value, never NULL.

The decision to avoid adding built-in functionality for indicating unset values was made to avoid creating user confusion between any VueCoreFramework-injected feature and any "None" or 0 value in the enum itself (imagine if the user saw "" followed by "None" in the drop-down, for instance). It is expected that it will be more common for developers to need to use existing enum types with an existing "None" value, than to have nullable columns represented by an enum.

Flags Enums

Since an enum with the FlagsAttribute applied is displayed as a multi-select, any 0 value will be omitted from the list of selections (since selecting it would be useless to the user: it wouldn't clear the current selections, it would be "OR'ed" with the other selections, producing exactly the same combined selection as before). The result should be what you expect for a multi-select: a list of choices which can be independently added and removed to produce a combined value; with a 0 value representing no selections, not a selection in itself.