C# 没有从ApplicationUser到Microsoft.AspNet.Identity.EntityFramework.IdentityUser的隐式引用转换
我正在尝试在UserStore的泛型参数上传递一个自定义的IdentityUser。 因此,我继承了IdentityUser并用它的必需泛型参数实现了所有必需的接口C# 没有从ApplicationUser到Microsoft.AspNet.Identity.EntityFramework.IdentityUser的隐式引用转换,c#,entity-framework,asp.net-identity,C#,Entity Framework,Asp.net Identity,我正在尝试在UserStore的泛型参数上传递一个自定义的IdentityUser。 因此,我继承了IdentityUser并用它的必需泛型参数实现了所有必需的接口 using Microsoft.AspNet.Identity; using Microsoft.AspNet.Identity.EntityFramework; using System; class Program { static void Main(string[] args) { var
using Microsoft.AspNet.Identity;
using Microsoft.AspNet.Identity.EntityFramework;
using System;
class Program
{
static void Main(string[] args)
{
var userStore = new UserStore<AppUser>(); //This is line that's triggering the error. AppUser has inherited all IdentityUser requirements, but I am not sure what I am missing here.
}
}
使用Microsoft.AspNet.Identity;
使用Microsoft.AspNet.Identity.EntityFramework;
使用制度;
班级计划
{
静态void Main(字符串[]参数)
{
var userStore=new userStore,但它的标识不像我在代码中所做的那样是自定义的。以下是我的答案,我只是错过了定义,而对Intellisense的敏锐关注可以解决这种情况:
var userStore = new UserStore<AppUser, AppRole, int, AppLogin, AppUserRole, AppClaim>(new MyDbContext(""));
var userStore = new UserStore<AppUser, AppRole, int, AppLogin, AppUserRole, AppClaim>(new MyDbContext(""));
public class AppUser : IdentityUser<int, AppLogin, AppUserRole, AppClaim>
{}
public class AppLogin : IdentityUserLogin<int>
{}
public class AppUserRole : IdentityUserRole<int>
{}
public class AppClaim : IdentityUserClaim<int>
{}
public class AppRole : IdentityRole<int, AppUserRole>
{}
var userStoreSimplified = new UserStore<AppUserSimplified>();
public class AppUserSimplified : IdentityUser
{}