确实整个地区的web.config设置MVC支持继承? [英] does mvc support inheritance of Web.config settings throughout areas?

查看:172
本文介绍了确实整个地区的web.config设置MVC支持继承?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我分配我的MVC code到几个不同的区域,并注意到一件事。
如果我有主的Web.config的东西,是这样的:

I distributed my MVC code into a few different areas and noticed one thing. if I have something in the main Web.config, something like:

  <system.web.webPages.razor>
     <pages pageBaseType="System.Web.Mvc.WebViewPage">
       <namespaces>
         <add namespace="System.Collections.Generic" />

这不属于根区域中的那些页一无所知那个。我要重复同样的事情在内部Web.config文件,在该地区的文件夹坐在之一。

those pages that don't belong to the root area know nothing about that. And I have to repeat the same thing in the inner Web.config, the one that sits in the area folder.

怎么来的?

推荐答案

的web.config 继承,但只有子文件夹。 〜/地区一个单独的文件夹〜/浏览次数所以你放在〜/区/ SomeAreaName /查看/ web.config中毫无共同之处与你放什么在〜/查看/ web.config中。而由于剃刀忽略〜/的web.config 你还挺需要重复它的区域的命名空间部分。

web.config inherit but only to subfolders. ~/Areas is a separate folder from ~/Views so what you put in ~/Areas/SomeAreaName/Views/web.config has nothing in common with what you put in ~/Views/web.config. And because Razor ignores the namespaces section in ~/web.config you kinda need to repeat it for areas.

在总结您有:


  • 〜/查看/ web.config中

  • 〜/地区/ SomeAreaName /查看/ web.config中

  • ~/Views/web.config
  • ~/Areas/SomeAreaName/Views/web.config

这是两个完全不同的文件夹和部分在它们不能被继承。

which are two completely distinct folders and sections in them cannot be inherited.

这篇关于确实整个地区的web.config设置MVC支持继承?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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