BgEngine.Infraestructure.Security.CodeFirstRoleProvider.GetRolesForUser C# (CSharp) Метод

GetRolesForUser() публичный Метод

public GetRolesForUser ( string userName ) : string[]
userName string
Результат string[]
        public override string[] GetRolesForUser(string userName)
        {
            if (string.IsNullOrEmpty(userName))
                    {
                        throw CreateArgumentNullOrEmptyException("userName");
                    }
                    using (BlogUnitOfWork context = new BlogUnitOfWork(new ModelContextInit()))
                    {
                        var user = context.Users.FirstOrDefault(Usr => Usr.Username == userName);
                        if (user == null)
                        {
                            throw new InvalidOperationException(string.Format("User not found: {0}", userName));
                        }
                        return user.Roles.Select(Rl => Rl.RoleName).ToArray();
                    }
        }