在我的项目架构中引用 Asp.net.Identity 的位置

Where to reference Asp.net.Identity in my project architecture

这是我第一次创建项目架构。我正在使用代码优先方法,我想使用身份验证和授权。

我创建了以下图层:

1- Project.Data - Application Context reside here.
2- Project.DTO - All ViewModels reside here.
3- Project.Entity - All Entities reside here.
4- Poject.Service - All interface and implementation reside here.
5- Project.API - Web API 2.0 reside here.
6- Project.UI - This is the Presentation Layer.

那么,我的问题是:

- Do I need to reference ASP.Net Identity to each layer? 
- If Yes Why?
- If No Which Layer is suitable to reference Identity?

3- Project.Entity - 所有实体都居住在这里。-

需要添加,因为您需要在此处实现身份接口以创建 asp.net 个身份实体

1- Project.Data - 应用程序上下文驻留在此处。

Asp.net 参考不适用于此处,仅适用 Project.Entity 并且您将仅访问 asp.net 身份

的实现类型

2- Project.DTO - 所有 ViewModel 都驻留在此处。

此处您有实体的投影类型和重构类型,因此asp.net身份不适用于此处

4- Poject.Service - 所有接口和实现都在这里。

这里需要实现业务逻辑所以需要asp.net身份参考

5- Project.API - Web API 2.0 位于此处。 6- Project.UI - 这是表示层。

对于这两层你需要实现认证相关的东西所以这里你也需要它