How can I save an enumeration value to a database?
问题 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! 回答1: 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