Search code examples
c#asp.net-identityentity-framework-core

Customise UserStore<T> class - EF core implementation of IUserStore


Iam trying to override one of the inherited method of UserStore class.

public class MyUserStore: UserStore<ApplicationUser>
    {
        public MyUserStore(ApplicationDbContext context) : base(context)
        {
        }
        public override Task<ApplicationUser> FindByIdAsync(string userId)
        {
            return null;
        }

    }

But i get an error saying "no suitable method found to override".But there is a method with that signature here


Solution

  • The method that you are trying to override includes a CancellationToken parameter:

    FindByIdAsync(String, CancellationToken)

    Your method should be:

    public override Task<ApplicationUser> FindByIdAsync(string userId, CancellationToken cancellationToken)
    {
         return null;
    }