[英]Move the Asp.net Identity 2 in another project
I am creating layered MVC Application that contains.我正在创建包含的分层 MVC 应用程序。
model layer: which is not using any reference for EF模型层:不使用任何 EF 参考
Data Layer: which contains the infrastructure.数据层:包含基础设施。 (Repositories and unit of work ) and this layer referenced with Entity framework
(存储库和工作单元)和实体框架引用的这一层
Service layer服务层
Web layer.网络层。
I am using Asp.net identity2.我正在使用 Asp.net identity2。 What I am doing is using
ApplicationUser
class in model layer and this leads me to reference model layer to Entity framework
and Microsoft.AspNet.Identity.EntityFramework
.我正在做的是在模型层中使用
ApplicationUser
类,这使我将模型层引用到Entity framework
和Microsoft.AspNet.Identity.EntityFramework
。 i am asking if there is a better way to do it, especially in feel that I am repeating my self while making both data layer and model layer using a reference to entity framework?我在问是否有更好的方法来做到这一点,尤其是感觉我在使用对实体框架的引用制作数据层和模型层的同时重复我自己?
I don't think I completely understand your question but consider not mixing your identity model with your domain objects model:我不认为我完全理解您的问题,但考虑不要将您的身份模型与域对象模型混合:
ASP.NET Identity is a presentation layer logic and you have to consider if it's a good idea detaching it from your topmost layer (Web). ASP.NET Identity 是一个表示层逻辑,您必须考虑将它与最顶层 (Web) 分离是否是一个好主意。
I would suggest you keep your Model or Domain project with Entity framework alone and avoid mixing it with objects that are directly related to presentation.我建议您单独使用实体框架保留模型或域项目,并避免将其与与表示直接相关的对象混合使用。
You can take a look at this post: https://aarcoraci.wordpress.com/2017/02/15/asp-net-mvc5-entity-framework-repository-pattern-and-unit-of-work-revisited/你可以看看这篇文章: https : //aarcoraci.wordpress.com/2017/02/15/asp-net-mvc5-entity-framework-repository-pattern-and-unit-of-work-revisited/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.