Support specifying a default value for a column corresponding to an enum model property #4081
Labels
closed-fixed
The issue has been fixed and is/will be included in the release indicated by the issue milestone.
type-enhancement
Milestone
Hi All,
I have an enum as follows:
public enum FirstTimeSignInDestination { Unknown = 0, Homepage = 1, GuardianDashboard = 2, Search = 3, AdopterDashboard = 4 }
In the
OnModelCreating()
override of myDbContext
-derived class I put the following:builder.Entity<ApplicationUser>().Property(p => p.FirstTimeSignInDestination). HasDefaultValue(FirstTimeSignInDestination.Unknown);
This compiles, but when I do
dnx ef migrations add FirstTimeSignInDestination
I get the following error message:Annotations of type 'FirstTimeSignInDestination' are not supported. Only common simple .NET types are currently supported.
Since I know
FirstTimeSignInDestination.Unknown
corresponds to0
I just used0
instead and everything works. It would be cool for this to work with one of the enum values as I'd tried, though.Thanks for your consideration.
Regards,
-Brian Eriksen
The text was updated successfully, but these errors were encountered: