【发布时间】:2017-11-08 13:04:24
【问题描述】:
我的 mvc5 项目具有以下结构。
我的 DAL 层中有 DbContext 文件,“实体”层中有“ApplicationUserManager”类,如下所示。
“实体”层中的“ApplicationUserManager”类具有以下代码,即。
public class ApplicationUserManager : UserManager<ApplicationUser>
{
public ApplicationUserManager(IUserStore<ApplicationUser> store)
: base(store)
{
}
public static ApplicationUserManager Create(IdentityFactoryOptions<ApplicationUserManager> options, IOwinContext context)
{
var manager = new ApplicationUserManager(new UserStore<ApplicationUser>(context.Get<ApplicationDbContext>()));
Here, I am getting error :
1. The type or namespace name 'ApplicationDbContext' could not be found (are you missing a using directive or an assembly reference?
2. The type or namespace name 'DAL' does not exist in the namespace 'MVCFinal' (are you missing an assembly reference?
现在,如果我向实体添加对 DAL 层的引用,那么很多其他东西都会被破坏。 如何纠正实体层中的此“ApplicationDbContext”错误。 引用 n 层中的层的正确方法是什么。
谢谢。
【问题讨论】:
标签: asp.net-mvc entity-framework n-tier-architecture