Base solution for your next web application
Ends in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

Access database from AuthorizationProvider #554


User avatar
0
alexnaldo created

Guys,

I need fro create dynamic permissions from database, but the below code doesn't work.

public class AppAuthorizationProvider : AuthorizationProvider
    {
       IRepository<MyTable> _repository;
        public AppAuthorizationProvider(IRepository<MyTable> repository)
        {
             _repository = repository;
        }
        public override void SetPermissions(IPermissionDefinitionContext context)
        {
                 var items = _repository.GetAll().ToList();
                ..
               ..
        }
}

How to make dependence valid from AppAuthorizationProvider ?

Thanks, Alexnaldo Santos


1 Answer(s)
  • User Avatar
    0
    hikalkan created
    Support Team

    Hi,

    What error are you getting? You should normally inject and use repository inside your AppAuthorizationProvider.