[英]Multiple projects in one visual studio solution
I am asp.net MVC beginner and I have just created new solution. 我是asp.net MVC的初学者,我刚刚创建了新的解决方案。 What I have noticed is that there is now an option of adding two projects under the same solution, and that is something that is new to me.
我注意到的是,现在可以在同一解决方案下添加两个项目,这对我来说是新的。
What is a main purpose that one should add multiple project under same solution? 在同一解决方案下添加多个项目的主要目的是什么?
A solution can hold multiple projects that are related and logically grouped together. 一个解决方案可以容纳多个相关的项目,这些项目在逻辑上组合在一起。 For example, a solution may contain two web site projects (a user site and an administration site) and then also a class library project that they both share which contains common database access code or business logic.
例如,一个解决方案可能包含两个网站项目(一个用户站点和一个管理站点),然后还包含它们都共享的一个类库项目,其中包含通用的数据库访问代码或业务逻辑。
Usually we separate our code into multiple projects for easier maintenance in future. 通常,我们将代码分成多个项目,以便将来进行维护。 On an high level we make separate Class libraries for Data Access, Domain Models, Business Logic.
在较高的层次上,我们为数据访问,域模型,业务逻辑创建了单独的类库。 Web project for Front end UI.
前端UI的Web项目。 This way we are physically separating code, that it increases re-usability.
这样,我们在物理上分离了代码,从而提高了可重用性。 Say in future you want to re-use your Data Access components, then build that class library and take the DLL and use it in other projects.
将来说您要重复使用数据访问组件,然后构建该类库并获取DLL并在其他项目中使用它。
Also in future if you want to replace a certain layer, then you can simply decouple it and change, without changing any other components of code. 同样在将来,如果您要替换特定的层,则可以简单地将其解耦并进行更改,而无需更改任何其他代码组件。
This physical segregation of code with Logical Dependency Injection would give you more cleaner, easy to maintain, re-usable, loosely coupled systems 通过逻辑依赖注入将代码进行物理隔离,将为您提供更干净,易于维护,可重用,松散耦合的系统
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.