Presentation <?> Domain <?> Persistence

元气小坏坏 提交于 2019-12-12 09:04:21

问题


Ok So I have a

  • PERSISTENCE layer, which grabs data from Entity Framework and puts it in some classes of its own, "Models", identical to the DB ones.
  • PRESENTATION layer, an MVC website
  • DOMAIN layer, which is a project independent to everything. Has some classes (Models) but not exactly as on the DB, has some business logic and so on.

How do I link these 3? (references)


回答1:


In a typical 3-tier Application architecture, you usually make your Data Access Layer (Data Persistence Layer if you will) reference your Domain Layer - You shouldn't add a reference from your Domain Model to your DAL, that'll create a circular dependency problem.

You then orchestrate the interaction between your Domain and Data Access Layers in your Presentation Layer (MVC App in your case).

In short:

  • Your DAL should reference your Domain Layer.
  • Your Presentation Layer should reference both your Domain Layer and DAL


来源:https://stackoverflow.com/questions/29285193/presentation-domain-persistence

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!