Why does this violate the type constraint?

前端 未结 3 1548
伪装坚强ぢ
伪装坚强ぢ 2020-12-06 00:19

I\'m trying to customise ASP.NET Identity 3 so that it uses integer keys:

public class ApplicationUserLogin : IdentityUserLogin { }
public class Ap         


        
3条回答
  •  死守一世寂寞
    2020-12-06 00:30

    Note for EF Core Users

    Just to add to the above, if you are using .Net core 3.0 (not sure about earlier versions), there is no longer a AddEntityFrameworkStores method.

    Instead there is a generic variant of IdentityDbContext so instead you derive your DbContext from IdentityDbContext

    e.g. in my case

    class ApplicationUser : IdentityUser {...}
    class ApplicationDbContext : IdentityDbContext, int> {...}
    

    then in your startup you can use services.AddDefaultIdentity

    cribbed from the last comment in https://github.com/aspnet/Identity/issues/1082

提交回复
热议问题