I have an enum type called Operation as follows:
[Flags] public enum Operation { None = 0, View = (1 << 0), Add = (1 << 1), Edit = (1 << 2), Delete = (1 << 3), ReservedA = (1 << 4), ReservedB = (1 << 5), Admin = (View | Add | Edit | Delete) }
and the permission table contains the operations column. This table maps to this class:
[Table("rolepermission")] public class Permission : IComparable { private int _id = 0; private Operation _operations = Operation.None; private List<UserRole> _roles = null; public Permission() { _roles = new List<UserRole>(); } [Key] public int Id { get { return _id; } set { _id = value; } } [EnumDataType(typeof(Operation))] public Operation Operations { get { return _operations; } set { _operations = value; } } }
but that will not work.
Is there any elegant way that can display it?
I think creating an int -type property is not the best way.
source share