|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
实不相瞒,net网页编程是我见过的执行效率最低的程序设计语言,前不久在CSDN论坛上有个评测,计算9999的阶乘,同样的循环算法,net网页编程的耗时是.NET的5倍。情况:asp.netmvc3vs2010
当利用多Area事情时,为了能在Area之间共享Shared目次,必要注册各自Shared地点。
在Global.asax.cs,必要以下增加分歧Area的Engine:
- publicclassMvcApplication:System.Web.HttpApplication
- {
- ...
- protectedvoidApplication_Start()
- {
- RegisterRoutes(RouteTable.Routes);
- ViewEngines.Engines.Add(newAgileViewEngine());
- ViewEngines.Engines.Add(newMySpaceViewEngine());
- ViewEngines.Engines.Add(newSFCViewEngine());
- }
- }
- publicclassAgileViewEngine:RazorViewEngine
- {
- privatestaticstring[]NewPartialViewFormats=new[]{
- "~/Areas/Agile/Views/Shared/{0}.cshtml",
- };
- publicAgileViewEngine()
- {
- base.PartialViewLocationFormats=base.PartialViewLocationFormats.Union(NewPartialViewFormats).ToArray();
- }
- }
- publicclassMySpaceViewEngine:RazorViewEngine
- {
- privatestaticstring[]NewPartialViewFormats=new[]{
- "~/Areas/MySpace/Views/Shared/{0}.cshtml"
- };
- publicMySpaceViewEngine()
- {
- base.PartialViewLocationFormats=base.PartialViewLocationFormats.Union(NewPartialViewFormats).ToArray();
- }
- }
- publicclassSFCViewEngine:RazorViewEngine
- {
- privatestaticstring[]NewPartialViewFormats=new[]{
- "~/Areas/SFC/Views/Shared/{0}.cshtml"
- };
- publicSFCViewEngine()
- {
- base.PartialViewLocationFormats=base.PartialViewLocationFormats.Union(NewPartialViewFormats).ToArray();
- }
- }
publicclassMvcApplication:System.Web.HttpApplication{...protectedvoidApplication_Start(){RegisterRoutes(RouteTable.Routes);ViewEngines.Engines.Add(newAgileViewEngine());ViewEngines.Engines.Add(newMySpaceViewEngine());ViewEngines.Engines.Add(newSFCViewEngine());}}publicclassAgileViewEngine:RazorViewEngine{privatestaticstring[]NewPartialViewFormats=new[]{"~/Areas/Agile/Views/Shared/{0}.cshtml",};publicAgileViewEngine(){base.PartialViewLocationFormats=base.PartialViewLocationFormats.Union(NewPartialViewFormats).ToArray();}}publicclassMySpaceViewEngine:RazorViewEngine{privatestaticstring[]NewPartialViewFormats=new[]{"~/Areas/MySpace/Views/Shared/{0}.cshtml"};publicMySpaceViewEngine(){base.PartialViewLocationFormats=base.PartialViewLocationFormats.Union(NewPartialViewFormats).ToArray();}}publicclassSFCViewEngine:RazorViewEngine{privatestaticstring[]NewPartialViewFormats=new[]{"~/Areas/SFC/Views/Shared/{0}.cshtml"};publicSFCViewEngine(){base.PartialViewLocationFormats=base.PartialViewLocationFormats.Union(NewPartialViewFormats).ToArray();}}如许,这三个Area的Views/Shared目次就能够共享了。
可怜的程序员,还是逃不出移植的命运! |
|