演示文稿 &lt;?&gt;域<?>坚持 [英] Presentation &lt;?&gt; Domain &lt;?&gt; Persistence

查看:29
本文介绍了演示文稿 &lt;?&gt;域<?>坚持的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好的所以我有一个

  • PERSISTENCE 层,它从实体框架中获取数据并将其放入自己的某些类模型"中,与数据库类相同.
  • PRESENTATION层,一个MVC网站
  • DOMAIN层,这是一个独立于一切的项目.有一些类(模型),但与数据库上的不完全一样,有一些业务逻辑等等.
  • 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)

推荐答案

在典型的 3 层应用程序架构中,您通常会制作数据访问层(Data Persistence层,如果你愿意)引用你的领域层 - 你不应该从你的领域模型中添加一个对你的 DAL 的引用,这会产生一个循环依赖问题.

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.

然后,您可以在表示层(在您的情况下为 MVC 应用程序)中协调域和数据访问层之间的交互.

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

简而言之:

  • 您的DAL 应该引用您的领域层.
  • 您的表示层应该同时引用您的领域层DAL
  • Your DAL should reference your Domain Layer.
  • Your Presentation Layer should reference both your Domain Layer and DAL

这篇关于演示文稿 &lt;?&gt;域<?>坚持的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆