非泛型类型 'IdentityUser' 不能与类型参数一起使用
The non-generic type 'IdentityUser' cannot be used with type arguments
我正在尝试将标识添加到我的 MVC 项目中。我想使用 int
作为我的密钥而不是 string
。当我尝试以下操作时出现此错误:
public partial class AppUser : Microsoft.AspNet.Identity.EntityFramework.IdentityUser<int>
{
}
是否有我需要执行此操作的库,或者是否有我缺少的参数?我是否需要将 IdentityDbContext
添加到我的 DbContext
,即使我已经有 运行 个脚本来添加所有身份表?
如果我删除 <int>
我不会收到错误。
EntityFramework
提供了一个 default implementation of the IdentityUser
that uses string as key type, but also a generic class ,您可以在其中自定义 IdentityUser
的几个属性的类型。要使用通用类型,您需要提供所有类型参数,而不仅仅是示例中的主键参数,例如:
public partial class AppUser : Microsoft.AspNet.Identity.EntityFramework.IdentityUser<int, IdentityUserLogin<int>, IdentityUserRole<int>, IdentityUserClaim<int>>
{
}
我正在尝试将标识添加到我的 MVC 项目中。我想使用 int
作为我的密钥而不是 string
。当我尝试以下操作时出现此错误:
public partial class AppUser : Microsoft.AspNet.Identity.EntityFramework.IdentityUser<int>
{
}
是否有我需要执行此操作的库,或者是否有我缺少的参数?我是否需要将 IdentityDbContext
添加到我的 DbContext
,即使我已经有 运行 个脚本来添加所有身份表?
如果我删除 <int>
我不会收到错误。
EntityFramework
提供了一个 default implementation of the IdentityUser
that uses string as key type, but also a generic class ,您可以在其中自定义 IdentityUser
的几个属性的类型。要使用通用类型,您需要提供所有类型参数,而不仅仅是示例中的主键参数,例如:
public partial class AppUser : Microsoft.AspNet.Identity.EntityFramework.IdentityUser<int, IdentityUserLogin<int>, IdentityUserRole<int>, IdentityUserClaim<int>>
{
}