SmartEnum
SmartEnum copied to clipboard
How to persist SmartFlagEnum in EF Core
Currently im using the following syntax in CodeFirst but EF Core complains about AccountRoles not having a primary key (I assume this was due to the missing convertor)
Is there a guide on how to use SmartFlagEnum with EFCore?
public virtual ICollection<AccountRoles> Roles { get; internal set; } = new HashSet<AccountRoles>();
public sealed class AccountRoles : SmartFlagEnum<AccountRoles> { public static readonly AccountRoles Primary = new AccountRoles("Primary", 1 << 0); public static readonly AccountRoles Secondary = new AccountRoles("Secondary", 1 << 1); }