我不确定这里有什么。我创建了一个简单的自定义RoleManager。
namespace Webservices.Infrastructure.Identity
{
public class PocketDoctorRoleManager : RoleManager<PocketDoctorRole>
{
public PocketDoctorRoleManager(RoleStore<PocketDoctorRole> store) : base(store) {
}
public static PocketDoctorRoleManager Create(IdentityFactoryOptions<PocketDoctorRoleManager> options, IOwinContext context)
{
return new PocketDoctorRoleManager(new RoleStore<PocketDoctorRole>(context.Get<PocketDoctorIdentityDbContext>()));
}
}
}
我正在尝试像这样访问IdentityDbInitalization类中的RoleExists扩展方法。
namespace Webservices.Infrastructure.Identity
{
public class PocketDoctorIdentityDbInitializer : CreateDatabaseIfNotExists<PocketDoctorIdentityDbContext>
{
protected override void Seed(PocketDoctorIdentityDbContext context)
{
PocketDoctorRoleManager roleMgr =
new PocketDoctorRoleManager(new RoleStore<PocketDoctorRole>(context));
string roleNameAdmin = "Administrators";
string userNameAdmin = "admin@porders.com";
string passwordAdmin = "secret";
string emailAdmin = "admin@porders.com";
roleMgr.RoleExist// this isn't found
base.Seed(context);
}
}
}
这可能是什么原因? 。如您所见,我在一个名称空间中也有所有类,因此我应该能够看到RoleManager的扩展方法。