I have the following code
private readonly RoleManager<IdentityRole> _roleManager;
private async Task DoStuff(MyViewModel viewModel)
{
var roles = await _roleManager.Roles;
var mylist = await _myRepository.SelectAll();
}
however the only method the role manager support is
public virtual IQueryable<TRole> Roles { get; }
and not an async method.
Github reference
resulting in only a _roleManager.Roles.ToList()
method and not a ToListAsync()
so I'm forced to change my code to
var roles = _roleManager.Roles;
however now it doesn't wait anymore and will cause unexpected behaviour since the method itself is asynchronous.
Question:
Is there anyway I can still use an asynchronous method for the above