分层体系结构内的一个大会 [英] Layered Architecture Inside One Assembly

查看:154
本文介绍了分层体系结构内的一个大会的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我preFER我的3层.NET应用程序分成单独的项目,以提高模块化和关注点分离,但我有我的电脑上的性能问题(没有足够的内存和处理能力),所以Visual Studio是缓慢的,而不是赏心悦目的。当有许多项目在一个解决方案的工作,所以把所有的层在一个集会,但仍使用code和设计它,就如同每个类型是在各自的层我虽然。我想知道一件事,如果有的话,你已经尝试这样做,你有什么建议或没有,或任何想法有关吗?
我不是在寻找一个讨论,我只是想知道是否有做这种方式的任何严重风险?

I Prefer to separate my 3 layer .NET applications into separate projects to enhance modularity and separation of concerns, but i have performance issues on my computer (not enough memory and processing power) so visual studio is slow and not pleasing to work with when there is many projects in one solution, so i though of putting all the layers in one assembly but still use the code and design it as if each type is in its respective layer. I want to know one thing, if any of you have tried doing this, is there anything you recommend or don't or any idea regarding this ?
I am not looking for a discussion, i just want to know if there is any serious risks doing it this way ?

推荐答案

其中之一是分层,有利于在.NET和其他强类型平台的原因之一是,你不能(容易)添加项目/库之间的循环引用。这确保了,至少在封装级,依赖关系会形成一个向无环图(DAG)。这是一件好事,因为它迫使我们为降低耦合

One of the reasons that layering is beneficial in .NET and other strongly-typed platforms is that you can't (easily) add circular references between projects/libraries. This ensures that, at least at the package level, dependencies will form a Directed Acyclic Graph (DAG). This is a good thing, because it forces us to reduce coupling.

C#,这是完全可能的编译code,形成循环图( ClassA的引用 ClassB的,它引用 ClassC ,这反过来又引用 ClassA的)。因此,把所有code到一个单一的Visual Studio C#项目删除某些编译时保护的层次感提供。

In C#, it's perfectly possible to compile code that forms Cyclic Graphs (ClassA references ClassB, which references ClassC, which in turn references ClassA). Thus, putting all code into a single Visual Studio C# project removes some of the compile-time protection that layering provides.

不过,如果不是你写在整个项目中的 F#,你会重新获得编译时的保护,因为F#code不能编译,如果它包含周期(尽管可以申报的具体例外的规则的的模块......看到互惠递归类型)。

However, if instead you write the entire project in F#, you'll regain that compile-time protection, because F# code doesn't compile if it contains cycles (although one can declare specific exceptions to that rule within a module... see the section on Mutually Recursive Types).

所以,如果C#编写整个应用程序,你最有可能会出现问题,但如果你在F#中写的话,你应该是不错的。

So, if write the entire application in C#, you're most likely going to have problems, but if you write it in F#, you should be good.

这篇关于分层体系结构内的一个大会的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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