码迷,mamicode.com
首页 > Web开发 > 详细

MVC 引擎优化

时间:2015-09-07 12:48:22      阅读:251      评论:0      收藏:0      [点我收藏+]

标签:

void ClearEngine()
{
// 移除 默认已经加载的Aspx 实体引擎
ViewEngines.Engines.RemoveAt(0);
//获取razor 视图引擎
RazorViewEngine razor= ViewEngines.Engines[0] as RazorViewEngine;

// 修改 区域视图 默认位置 格式
string[] areaViewLocationFormats = new string[2]{
"~/Areas/{2}/Views/{1}/{0}.cshtml",
"~/Areas/{2}/Views/Shared/{0}.cshtml" };

razor.AreaViewLocationFormats = areaViewLocationFormats;
razor.AreaPartialViewLocationFormats = areaViewLocationFormats;
razor.AreaMasterLocationFormats = areaViewLocationFormats;


//修改视图默认位置格式
string[] viewLocalFormats = new string[2]
{
"~/Views/{1}/{0}.cshtml",
"~/Views/Shared/{0}.cshtml"};
razor.ViewLocationFormats = viewLocalFormats;
razor.PartialViewLocationFormats = viewLocalFormats;
razor.MasterLocationFormats = viewLocalFormats;

}

 

----在gloable中 添加这个方法 就只会

技术分享

MVC 引擎优化

标签:

原文地址:http://www.cnblogs.com/cdaq/p/4788512.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!