For example:
namespace PizzaSoftware.Data
{
public class User
{
public string Username { get; set; }
public string Password { get; set; }
public Permission PermissionType { get; set; }
}
public enum Permission
{
Basic,
Administrator
}
}
If if I were to use Entity-Framework's CodeFirst, how can I save this value?
This is for a Windows Forms, Desktop application.
Thank you!
You can retrieve the int value (or whatever type you have your enum set to) via a simple cast and save that to the DB.
And to read it back out, you'd cast from int back to enum:
Permission enumValue = (Permission)intValue;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With