首页 > Web开发 > 详细

MVC 引擎优化

时间:2015-09-07 12:46:26      阅读:353      评论: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
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!