-
-
Notifications
You must be signed in to change notification settings - Fork 170
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to persist SmartFlagEnum in EF Core #379
Comments
Tagging @AFM-Horizon |
Same problem, any improvement |
Most of the functions that come with SmartFlagEnum return an IEnumerable (e.g. .FromValue). So there are 2 options:
And then convert it when you configure the Entity:
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 Roles { get; internal set; } = new HashSet();
public sealed class AccountRoles : SmartFlagEnum {
public static readonly AccountRoles Primary = new AccountRoles("Primary", 1 << 0);
public static readonly AccountRoles Secondary = new AccountRoles("Secondary", 1 << 1);
}
The text was updated successfully, but these errors were encountered: