我正在使用.NET Framework 4.5.1和Asp.Net Identity 2.1.0开发Web Api 2.2应用程序.
我不确定我在做什么,但我想将我的数据库与ASP.NET Identity数据库合并,我已经这样做了:
我自己的dbContext
.
public class EFDbContext : IdentityDbContext, IUnitOfWork
我自己的User
课.
public class User : IdentityUser, IdentityUserRole , IdentityUserClaim >
但是当我这样做时:
UserManager
我收到此错误:
该类型Data.Models.User
不能用作类型的参数TUser
.没有任何显式转换Data.Models.User
到Microsoft.AspNet.Identity.IUser
.
因为我想有我这样做是IdentityUser.Id
为long
代替string
.
我该如何解决这个错误?
UPDATE
用以下内容更新UserManager后:
UserManager_userManager;
我在这里得到三个错误:
EFDbContext_ctx = context as EFDbContext; _userManager = new UserManager(new UserStore (_ctx));
"Microsoft.AspNet.Identity.UserManager.UserManager(Microsoft.AspNet.Identity.IUserStore)"方法重载的最佳匹配有一些无效的参数 -
"Data.Models.User"类型不能用作"TUser"类型的参数或通用方法"Microsoft.AspNet.Identity.EntityFramework.UserStore".没有从'Data.Models.User'到'Microsoft.AspNet.Identity.EntityFramework.IdentityUser'的隐式引用的转换.
参数1:无法从"Microsoft.AspNet.Identity.EntityFramework.UserStore"转换为"Microsoft.AspNet.Identity.IUserStore"
我该如何解决这个新错误?