任何人都有想法,如何添加对不同图层的引用?(在3LayeredArchitecture中) [英] ANy one have Idea about,How to add reference to different layers?(in 3LayeredArchitecture)

查看:50
本文介绍了任何人都有想法,如何添加对不同图层的引用?(在3LayeredArchitecture中)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你能解释一下,如何添加对不同层的引用

1.Presentation Layer

2.Business Logic Layer

3.Data访问层

4.Value Objects

Can you explain ,How to add reference to different layers
1.Presentation Layer
2.Business Logic Layer
3.Data Access Layer
4.Value Objects

推荐答案

Dataacess层应该引用值对象。

业务逻辑图层应该引用数据访问层。



表示层可以通过直接引用或通过Web服务或其他路径访问业务层。
Dataacess layer should have references to value objects.
Business logic layer should have reference to the data access layer.

The presentation layer would have access to either the business layer via either a direct reference or via web services or some other route.


据推测,您知道如何在解决方案中将每个图层创建为单独的项目吗?



所以你只需要do打开项目(例如PL)并右键单击Solution Explorer窗格中的References分支。

选择Add Reference ...菜单项,然后等待对话框(可能需要一段时间才能显示)。

选择项目选项卡(在左侧)然后选择项目y你将使用(例如BL或DL)。完成后按添加然后关闭。

您现在可以在项目中使用图层类(但是您需要使用添加作为VS的陈述不会对你这样做。)



请注意,除非你需要,否则你不应该添加引用:如果你添加它们因为它们是你会引起问题 - 你不允许有PL引用的循环引用

BL和BL直接或间接通过DL指PL(例如)。
Presumably, you know how to create each layer as a separate project within your solution?

So all you need to do is open the project (PL for example) and right click the "References" branch in the Solution Explorer pane.
Select the "Add Reference..." menu item, and then wait for the dialog (it can take a while to show).
Select the "Projects" tab (on the left hand side) then the project you are going to use (BL or DL for example). Press Add and then Close when you are done.
You can now use the layer classes in your project (but you will need to add the using statements as VS won't do that for you).

Do note that you shouldn't add references unless you need them: if you add them "because they are there" you will cause problems - you are not allowed to have circular references where PL refers to
BL and BL refers to PL (for example) either directly or indirectly via DL.


这篇关于任何人都有想法,如何添加对不同图层的引用?(在3LayeredArchitecture中)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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