Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/267.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/entity-framework/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# ApiAuthorizationDbContext主键为int_C#_Entity Framework_Model View Controller_.net Core_Asp.net Identity - Fatal编程技术网

C# ApiAuthorizationDbContext主键为int

C# ApiAuthorizationDbContext主键为int,c#,entity-framework,model-view-controller,.net-core,asp.net-identity,C#,Entity Framework,Model View Controller,.net Core,Asp.net Identity,我想将AspNetUsers的主键从string更改为int public class ApplicationUser : IdentityUser<int> { public short FactoryId { get; set; } public Factory Factory { get; set; } } 公共类应用程序用户:IdentityUser { 公共短因子ID{get;set;

我想将AspNetUsers的主键从string更改为int

    public class ApplicationUser : IdentityUser<int>
        {
            public short FactoryId { get; set; }
            public Factory Factory { get; set; }
        }
公共类应用程序用户:IdentityUser
{
公共短因子ID{get;set;}
公共工厂工厂{get;set;}
}
但编译器对此并不满意:

public class ApplicationDbContext : ApiAuthorizationDbContext<ApplicationUser>{

}
public类ApplicationDbContext:ApiAuthorizationDbContext{
}
它说:

类型“Domain.Identity.ApplicationUser”不能用作泛型类型或方法“ApiAuthorizationDbContext”中的类型参数“TUser”。没有从“Domain.Identity.ApplicationUser”到“Microsoft.AspNetCore.Identity.IdentityUser”的隐式引用转换


有什么想法吗?

这能回答你的问题吗?