简体   繁体   English

具有通用布局的解决方案中的多个MVC项目

[英]Multiple MVC projects in a solution with common layout

I have searched and looked around for possible solutions, but have not found it. 我已经搜索并四处寻找可能的解决方案,但没有找到它。 Basically there's a need for us to have multiple projects in a solution, since most of our mvc apps use common library such as AD authentication, SQL objects. 基本上,我们需要在一个解决方案中包含多个项目,因为我们的大多数mvc应用程序都使用公共库,例如AD身份验证,SQL对象。 And we want all our mvc web app to have a common layout. 我们希望所有的mvc Web应用程序都具有通用的布局。 below are some of the possible solution proposed by others I've seen online: 以下是我在网上看到的其他人提出的一些可能的解决方案:

  1. Area - it is nice, does almost what I wanted except it compiles into one single dll. 区域-很好,除了将它编译成一个dll以外,几乎可以执行我想要的任何操作。 The reason why I prefer multiple projects is that each team can work on certain project compile into its own dll and will not affect the overall application. 我之所以选择多个项目,是因为每个团队都可以将某些项目工作到自己的dll中,并且不会影响整个应用程序。

  2. Razor generator - I tested this out. 剃刀发生器-我对此进行了测试。 I could be wrong, but this tool is used mainly for sharing views/controllers across projects. 我可能是错的,但是该工具主要用于跨项目共享视图/控制器。 I don't think this applies to what I'm looking for. 我认为这不适用于我正在寻找的东西。

Having multiple mvc project in solution just for separating them for teams is not a good idea as you will have to add lot's of configuration both in development process and deployment. 在解决方案中只有多个mvc项目只是为了将它们分隔成团队不是一个好主意,因为您将不得不在开发过程和部署中添加大量的配置。 as you mentioned the first solution is better. 正如您提到的,第一个解决方案更好。 but I suggest you to use portable areas of mvc if you really want to separate the concerns of your team working and don't need multiple standalone mvc project. 但是,如果您确实希望将团队工作的关注点分开,并且不需要多个独立的mvc项目,则建议您使用mvc的可移植区域。 you can embed a _layout in a core class library (a core assembly for all the common configurations of your areas) and reference all of the ares. 您可以将_layout嵌入核心类库(您所在区域的所有常用配置的核心程序集)中,并引用所有ares。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM