/// <summary> /// 映射MVC插件路由 /// </summary> /// <param name="mvcPlus"></param> public static void MapRouteMVCPlus(IMVCPlusInfo mvcPlus) { switch (mvcPlus.MvcPlusType) { ////此类型插件只支持一个 //case MvcPlusTypes.MVCHome: // break; case MvcPlusTypes.MVC: { RouteTable.Routes.MapRoute( name: "MCV_" + mvcPlus.PlusName, url: "_{pluginName}/{controller}/{action}/{id}", defaults: new { action = "Index", id = UrlParameter.Optional, pluginName = mvcPlus.PlusName }); } break; //此类型插件只支持一个 case MvcPlusTypes.MVCAdmin: { RouteTable.Routes.MapRoute( name: "MCV_" + mvcPlus.PlusName, url: "admin/{controller}/{action}/{id}", defaults: new { action = "Index", controller = "Admin", id = UrlParameter.Optional, pluginName = mvcPlus.PlusName }); } break; default: break; } }
/// <summary> /// 映射MVC插件路由 /// </summary> /// <param name="mvcPlus"></param> public static void MapRouteMVCPlus(IMVCPlusInfo mvcPlus) { switch (mvcPlus.MvcPlusType) { ////此类型插件只支持一个 //case MvcPlusTypes.MVCHome: // break; case MvcPlusTypes.MVC: { RouteTable.Routes.MapRoute( name: "MCV_" + mvcPlus.PlusName, url: "_{pluginName}/{controller}/{action}/{id}", defaults: new { action = "Index", id = UrlParameter.Optional, pluginName = mvcPlus.PlusName }); } break; //此类型插件只支持一个 case MvcPlusTypes.MVCAdmin: { RouteTable.Routes.MapRoute( name: "MCV_" + mvcPlus.PlusName, url: "admin/{controller}/{action}/{id}", defaults: new { action = "Index", controller = "Admin", id = UrlParameter.Optional, pluginName = mvcPlus.PlusName }); } break; default: break; } }
/// <summary> /// 注册文档协议 /// </summary> /// <param name="mvcPlus"></param> public void RegisterDocumentsOpenProtocols(IMVCPlusInfo mvcPlus) { if (mvcPlus.PlusConfigInfo != null && mvcPlus.PlusConfigInfo.DocumentOpenProtocols != null && mvcPlus.PlusConfigInfo.DocumentOpenProtocols.Length > 0) { foreach (var protocol in mvcPlus.PlusConfigInfo.DocumentOpenProtocols) { if (!DocumentOpenProtocols.Any(p => p.ContentType.Equals(protocol.ContentType, StringComparison.CurrentCultureIgnoreCase))) { protocol.PluginName = mvcPlus.PlusName; DocumentOpenProtocols.Add(protocol); } } } }
/// <summary> /// 注册文档协议 /// </summary> /// <param name="mvcPlus"></param> public void RegisterDocumentsOpenProtocols(IMVCPlusInfo mvcPlus) { if (mvcPlus.PlusConfigInfo != null && mvcPlus.PlusConfigInfo.DocumentOpenProtocols != null && mvcPlus.PlusConfigInfo.DocumentOpenProtocols.Length > 0) { foreach (var protocol in mvcPlus.PlusConfigInfo.DocumentOpenProtocols) { if (!DocumentOpenProtocols.Any(p => p.ContentType.Equals(protocol.ContentType, StringComparison.CurrentCultureIgnoreCase))) { protocol.PluginName = mvcPlus.PlusName; DocumentOpenProtocols.Add(protocol); } } } }