Asp.Net Identity,Web项目和DAL Layer

问题描述 投票:3回答:1

今天我需要一些关于我目前正在努力解决的问题的建议

我正在开展一个有3层的项目

1) DAL
2) BAL
3) Web
4) Entities (This is a separate project which contain only the entities 
         that will be use to create DB tables with EF Code first)

Entities being reference in all the 3 layers
DAL being referenced in BAL and Web
BAL being referenced in Web

我想从DAL项目中获取Web参考,我的Web项目通常与BAL一起交谈。由于DAL ASP.NET IdentityStartup.Auth.cs类,我必须引用IdentityConfig.cs的唯一原因。每个文件都包含一行代码,需要访问我的DBContext项目中的DAL

IdentityConfig.cs:

var manager = new ApplicationUserManager
         (new UserStore<ApplicationUser>(context.Get<MyDbContext>()));

Startup.Auth.cs:

 app.CreatePerOwinContext(MyDbContext.Create);

我怎么可能调整我没有在Web项目中引用DAL的东西?你能建议吗?

谢谢

.net asp.net-identity dbcontext
1个回答
1
投票

您正在创建一个4层体系结构。在数据访问层中实现相应的逻辑,并在业务层中引用它。所以最后你只能在你的网站中引用BL。

© www.soinside.com 2019 - 2024. All rights reserved.