Skip to content
This repository was archived by the owner on Dec 20, 2018. It is now read-only.
This repository was archived by the owner on Dec 20, 2018. It is now read-only.

UserManager CancellationToken private #969

@ketrex2

Description

@ketrex2

Why is the CancellationToken in UserManager private and not protected so it is available to derived class methods and properties?

public class Microsoft.AspNetCore.Identity.UserManager<TUser>
{
    // why private?
    private CancellationToken CancellationToken => _context?.RequestAborted ?? CancellationToken.None;
}

I have created a new class inheriting from UserManager and added a few new async methods that could make use of the cancellation token if only it was available.

example:

public class UserManager<TUser> : Microsoft.AspNetCore.Identity.UserManager<TUser> ...
{
    ...

    // Retrieving custom firstname property from TUser
    public async Task<string> GetFirstNameAsync(TUser user)
    {
        ThrowIfDisposed();
        return await Store.GetFirstNameAsync(user, CancellationToken); // won't work because cancellation token is not available in UserManager
    }
}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions