MVC 引擎优化
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中 添加这个方法 就只会
【推荐】还在用 ECharts 开发大屏?试试这款永久免费的开源 BI 工具!
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步