public Privilege(MasterEnum master, int masterValue, AccessEnum access, int accessValue) { Master = master.ToString(); MasterValue = masterValue; Access = access.ToString(); AccessValue = accessValue; }
/// <summary> /// 根据权限对象(Master)及功能对象(Access)获取Privilege的列表 /// </summary> /// <param name="query"></param> /// <param name="master">主体对象类型(角色或者用户)</param> /// <param name="access">领域对象(菜单或者按钮)</param> /// <param name="masterValues">主体对象Id</param> /// <returns></returns> public static IQueryable <Privilege> Get(this IQueryable <Privilege> query, MasterEnum master, AccessEnum access, params int[] masterValues) { return(query.Where(x => x.Master == master.ToString() && x.Access == access.ToString() && masterValues.Contains(x.MasterValue))); }