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

UserManager CancellationToken private #969

Closed
ketrex2 opened this issue Sep 17, 2016 · 1 comment
Closed

UserManager CancellationToken private #969

ketrex2 opened this issue Sep 17, 2016 · 1 comment

Comments

@ketrex2
Copy link
Contributor

ketrex2 commented Sep 17, 2016

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
    }
}
@HaoK HaoK added this to the 1.1.0 milestone Sep 23, 2016
@HaoK
Copy link
Member

HaoK commented Sep 26, 2016

dbec1c6

@HaoK HaoK closed this as completed Sep 26, 2016
@HaoK HaoK added 3 - Done and removed 2 - Working labels Sep 26, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants