【发布时间】:2016-03-25 06:01:04
【问题描述】:
当我尝试使用 Asp.Net Identity RoleStore 并使用 StructureMap 作为 DI 容器时,UserStore 工作正常,但 RoleStore 在编译本身时抛出错误。
//works fine
cfg.For<IUserStore<ApplicationUser>>().Use<UserStore<ApplicationUser>>();
//does NOT work
cfg.For<IRoleStore<IdentityRole>>().Use<RoleStore<IdentityRole>>();
抛出以下错误
类型 'Microsoft.AspNet.Identity.EntityFramework.RoleStore' 不能用作泛型类型中的类型参数“TConcreteType” 或方法 'StructureMap.Configuration.DSL.Expressions.CreatePluginFamilyExpression.Use()'。 没有隐式引用转换 'Microsoft.AspNet.Identity.EntityFramework.RoleStore' 到 'Microsoft.AspNet.Identity.IRoleStore'。
【问题讨论】:
标签: asp.net-mvc-5 asp.net-identity structuremap user-roles