static void OnAddinStopping(Addin addin) { // 删除路由 object ar; var key = addin.Header.Name + "/" + PrivateAreaRegistrations; if (addin.Context.Framework.TryGetProperty(key, out ar)) { var privateAreaReg = ar as JointCode.AddIns.Mvc.System.AreaRegistration; if (privateAreaReg != null) { AreaRegistrationHelper.UnregisterArea(privateAreaReg); } else { AreaRegistrationHelper.UnregisterArea(addin.Header.Name); } } else { AreaRegistrationHelper.UnregisterArea(addin.Header.Name); } // 删除程序集引用 foreach (var asm in addin.Runtime.LoadedAssemblies) { BuildManagerHelper.RemoveReferencedAssembly(asm); } //// 删除私有程序集探测路径 //var probingPath = AppDomain.CurrentDomain.SetupInformation.PrivateBinPath; //probingPath.Replace(args.Addin.File.BaseDirectory + ";", string.Empty); //AppDomain.CurrentDomain.SetupInformation.PrivateBinPath = probingPath; } }
static void OnAddinStarted(Addin addin) { //// 添加私有程序集探测路径 //var probingPath = AppDomain.CurrentDomain.SetupInformation.PrivateBinPath ?? string.Empty; //probingPath += args.Addin.File.BaseDirectory + ";"; //AppDomain.CurrentDomain.SetupInformation.PrivateBinPath = probingPath; // 添加路由 var asms = addin.Runtime.LoadAssemblies(); JointCode.AddIns.Mvc.System.AreaRegistration areaReg = null; // private AreaRegistration implementations foreach (var asm in asms) { Type[] types; if (!JcMvcUtil.TryGetTypes(asm, out types)) { continue; } foreach (var type in types) { if (!type.IsClass || type.IsAbstract) { continue; } if (!typeof(JointCode.AddIns.Mvc.System.AreaRegistration).IsAssignableFrom(type)) { continue; } var ar = Activator.CreateInstance(type) as JointCode.AddIns.Mvc.System.AreaRegistration; if (ar != null && areaReg != null) { throw new ConfigurationException(string.Format("More than one private area registrations has been found in addin [{0}]!", addin.Header.Name)); } areaReg = ar; AreaRegistrationHelper.RegisterArea(ar, null); } } if (areaReg != null) { var key = addin.Header.Name + "/" + PrivateAreaRegistrations; if (addin.Context.Framework.ContainsPropertyKey(PrivateAreaRegistrations)) { throw new ConfigurationException(string.Format( "The private area registration key [{0}] for addin [{1}] has been taken, please use another area name and try again!", key, addin.Header.Name)); } addin.Context.Framework.SetProperty(key, areaReg); } else { AreaRegistrationHelper.RegisterArea(addin.Header.Name, null); // 添加路由 } // 添加程序集引用 foreach (var asm in asms) { BuildManagerHelper.AddReferencedAssembly(asm); } }
public override void RegisterArea(AreaRegistrationContext context, IApplicationBus bus) { RegistApi(); bus.Send(new NHRegisterEventMessage(typeof(IMemberShipFactory), typeof(MemberShipFactory))); //send the init data bus.Send(new MemberShipData()); ResourceSetting.Registry(); context.MapRoute( AreaName + "_images", AreaRoutePrefix + "/images/{resourceName}", new { controller = "OrnamentEmbeddedResource", action = "Index", resourcePath = "images" }, new[] { "Ornament.Web.Controllers" } ); //MemberShips/User/Edit/admin context.MapRoute(AreaName + "_EditUser", AreaName + "/User/Edit/{loginId}", new { action = "Edit", loginId = UrlParameter.Optional, controller = "User" } ); context.MapRoute( AreaName + "_AssingUser", AreaName + "/User/Assign/{loginId}", new { action = "Assign", loginId = UrlParameter.Optional, controller = "User" }, new[] { "Ornament.MemberShip.Plugin.Areas.MemberShips.Controllers" } ); context.MapRoute( AreaName + "_default", AreaName + "/{controller}/{action}/{id}", new { action = "Index", id = UrlParameter.Optional }, new[] { "Ornament.MemberShip.Plugin.Areas.MemberShips.Controllers" } ); var helper = new AreaRegistrationHelper(this, context); helper.RegistSeajsModule("Scripts/User"); helper.RegistSeajsModule("Scripts/Org"); helper.RegistSeajsModule("Scripts/Role"); helper.RegistSeajsModule("Scripts/Share"); helper.RegistSeajsModule("Scripts/Permissions"); base.RegisterArea(context, bus); }
public override void RegisterArea(AreaRegistrationContext context, IApplicationBus bus) { bus.Send(new DataInit()); bus.Send(new NHRegisterEventMessage(typeof(IRegionDaoFactory), typeof(RegionDaoFactory))); var helper = new AreaRegistrationHelper(this, context); helper.RegistSeajsModule("Scripts"); context.MapRoute( AreaName + "_default", AreaRoutePrefix + "/{controller}/{action}/{id}", new { action = "Index", id = UrlParameter.Optional } ); base.RegisterArea(context, bus); }
public override void RegisterArea(AreaRegistrationContext context, IApplicationBus bus) { bus.Send(new NHRegisterEventMessage(typeof(IMessageDaoFactory), typeof(MessageDaoFactory))); //初始化数据 bus.Send(new MessageInit()); OrnamentContext.ResourceManager.Add("Template", typeof(MessageOperator)); var helper = new AreaRegistrationHelper(this, context); helper.RegistScripts("Scripts/News"); helper.RegistScripts("Scripts/NewsType"); helper.RegistScripts("Scripts/NotifyType"); helper.RegistScripts("Scripts/Template"); helper.RegistScripts("Scripts/Config"); context.MapRoute( AreaName + "_images", AreaRoutePrefix + "/images/{resourceName}", new { controller = "OrnamentEmbeddedResource", action = "Index", resourcePath = "images" }, new[] { "Ornament.Web.Controllers" } ); context.MapRoute( AreaName + "_default", AreaRoutePrefix + "/{controller}/{action}/{id}", new { action = "Index", id = UrlParameter.Optional } ); base.RegisterArea(context, bus); }