/// <summary> /// 重置插件。 /// </summary> private static void ResetPlugin() { lock (_lockobject) { LEnvironment.StartupPlugins(); } }
public static void AddPluginReferencedAssemblies() { var assemlbies = LEnvironment.GetAllPluginAssemblys(); assemlbies.ForEach(AddReferencedAssembly); assemlbies.ForEach(DefaultControllerConfig.Register); }
public static string Content(string symbolicName, string url) { var bundle = LEnvironment.GetPlugin(symbolicName); if (bundle == null) { throw new Exception(string.Format("Bundle {0} doesn't exists.", symbolicName)); } return(Content(bundle.Instance, url)); }
internal static void TryAddPluginsService() { Logger.LogInfo("DomainServiceLocator Initialize......"); //TODO:组件初始化 var plugins = LEnvironment.GetAllPluginAssembly(); foreach (var plugin in plugins) { TryAddAssemblyService(plugin.Assembly); } }
internal static void TryAddPluginsService() { Logger.LogInfo("RepositoryLocator Initialize......"); //TODO:组件初始化 var plugins = LEnvironment.GetAllPluginAssembly(); foreach (var plugin in plugins) { TryAddAssemblyService(plugin.Assembly); //ServiceLocator.Instance.RegisterTypes(p => p., plugin.Assembly); } }
protected override Type GetControllerType(RequestContext requestContext, string controllerName) { var symbolicName = requestContext.GetPluginSymbolicName(); if (symbolicName != null) { var controllerType = ControllerTypeCache.GetControllerType(symbolicName, controllerName); if (controllerType != null) { return(controllerType); } var controllerTypeName = controllerName + "Controller"; var plugin = LEnvironment.GetAllPlugins().FirstOrDefault(p => p.Assembly.GetName().Name == symbolicName); if (plugin != null) { foreach (var type in plugin.Assembly.GetTypes()) { if (type.Name.Contains(controllerTypeName) && typeof(IController).IsAssignableFrom(type)) { controllerType = type; ControllerTypeCache.AddControllerType(symbolicName.ToString(), controllerName, controllerType); Logger.LogInfo(string.Format("Loaded controller '{0}' from bundle '{1}' and then added to cache.", controllerName, symbolicName)); return(controllerType); } } } Logger.LogInfo(string.Format("Failed to load controller '{0}' from bundle '{1}'.", controllerName, symbolicName)); } try { //if exists duplicated controller type, below will throw an exception. return(base.GetControllerType(requestContext, controllerName)); } catch (Exception ex) { Logger.LogError("PluginControllerFactory GetControllerType : ", ex); } requestContext.RouteData.DataTokens["pluginName"] = symbolicName; requestContext.RouteData.DataTokens["Namespaces"] = ControllerTypeCache.DefaultNamespaces; var result = base.GetControllerType(requestContext, controllerName); if (result != null) { return(result); } Logger.LogWarn(string.Format("no is controller '{0}' from bundle '{1}' and then added to cache.", controllerName, symbolicName)); return(null); }
public static string[] GetPluginControllerNamespaces(string pluginName) { List <string> list = new List <string>(); var plugin = LEnvironment.GetPlugin(pluginName); if (plugin != null && plugin.Assembly != null) { foreach (var type in plugin.Assembly.GetExportedTypes()) { if (!type.IsAbstract && typeof(IController).IsAssignableFrom(type)) { if (type.Namespace != null) { list.Add(type.Namespace); } } } } return(list.ToArray()); }
public void InitPath() { Logger.LogInfo("PluginRazorViewEngine InitPath...."); foreach (var item in LEnvironment.GetPluginsName()) { if (item.EndsWith("Plugin")) { Logger.LogInfo("~/Plugins/" + item + "/Views/{1}/{0}.cshtml"); this._areaViewLocationFormats.Add("~/Plugins/" + item + "/Views/{1}/{0}.cshtml"); this._areaViewLocationFormats.Add("~/Plugins/" + item + "/Views/Shared/{0}.cshtml"); this._pluginViewLocationFormats.Add("~/Plugins/" + item + "/Views/{1}/{0}.cshtml"); this._pluginViewLocationFormats.Add("~/Plugins/" + item + "/Views/Shared/{0}.cshtml"); } } this.AreaMasterLocationFormats = this._areaViewLocationFormats.ToArray(); this.ViewLocationFormats = this._pluginViewLocationFormats.ToArray(); this.MasterLocationFormats = this._areaViewLocationFormats.ToArray(); this.PartialViewLocationFormats = this._pluginViewLocationFormats.ToArray(); }
public DomainService() { this._dataPortalLocation = LEnvironment.IsOnServer() ? DataPortalLocation.Local : DataPortalLocation.Local; }
//TODO: ´´½¨²å¼þÊÓͼ public PluginRuntimeViewEngine(IPluginViewEngineFactory viewEngineFactory) { this.BundleViewEngineFactory = viewEngineFactory; LEnvironment.GetAllPlugins().ForEach(AddViewEngine); }