简体   繁体   English

一个Visual Studio解决方案中的多个项目

[英]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.

相关问题 使用文本编辑器创建具有多个项目的Visual Studio 2010解决方案 - Create a Visual Studio 2010 Solution with multiple projects from a text editor 在一个解决方案中重定向多个项目 - Redirecting in multiple projects in one solution 在ASP.NET中的一种解决方案下访问不同项目中的Webforms.Visual Studio 2012 - Access Webforms in different projects under one solution in Asp .net.Visual studio 2012 如何在 Visual Studio 2015 中的一个解决方案中跨多个 ASP.NET CORE 项目共享 appsettings.json 等配置文件? - How can I share config file like appsettings.json across multiple ASP.NET CORE projects in one solution in Visual Studio 2015? c# .net - 关于 Visual Studio 2010 中同一解决方案下的多个项目的问题 - c# .net - Question about multiple Projects under same solution in Visual Studio 2010 一个解决方案中的多个Web项目,配置转换 - Multiple Web Projects in one solution, Config Transforms 如何使用 .NET 框架和 .NET 标准项目构建 Visual Studio 解决方案? - How to build Visual Studio solution with .NET Framework and .NET Standard projects? Visual Studio 2010:如何在解决方案中强制执行项目的构建顺序? - Visual Studio 2010: How to enforce build order of projects in a solution? 多个项目Visual Studio 2015 npm - Multiple Projects Visual Studio 2015 npm Visual Studio 22 多个启动项目 - Visual Studio 22 Multiple Startup Projects
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM