How to handle 5 million users? ASP.NET Identity

后端 未结 4 1707
你的背包
你的背包 2021-02-06 01:26

I am running a ASP.NET mvc5 app which currently has 5 million users. It is hosted in the Azure cloud. For the authentication I use the Asp.Net Identity for EntityFramework.

4条回答
  •  攒了一身酷
    2021-02-06 02:20

    While I had to replace the userId guid with an int, I created a CustomUserStore. In this UserStore you can simply overwrite the FindByNameAsync:

    public class CustomUserStore : UserStore where TUser : MyUser
    {
        public CustomUserStore(MyDbContext context) : base(context) { }
    
        public override Task FindByNameAsync(string userName)
        {
            return this.GetUserAggregateAsync(u => u.UserName.Equals(userName, StringComparison.InvariantCultureIgnoreCase));
        }
    }
    

    This results in a query without UPPER().

提交回复
热议问题