public UserAuthorizeAttribute(params object[] roles) { if (roles.Any(r => r.GetType().BaseType != typeof(Enum))) { throw new ArgumentException("roles"); } this.Roles = string.Join(",", roles.Select(r => Enum.GetName(r.GetType(), r))); db = new CoursePlatformEntities(); }