public Startup(IHostingEnvironment environment, ILoggerFactory loggerFactory) { // Set up configuration sources. var builder = new ConfigurationBuilder() .SetBasePath(environment.ContentRootPath) .AddJsonFile("settings.json", optional: true, reloadOnChange: true) .AddJsonFile($"settings.{environment.EnvironmentName}.json", optional: true); builder.AddEnvironmentVariables(); _environment = environment; _loggerFactory = loggerFactory; _configuration = builder.Build(); // TODO: Move to Plugin Initialization // Startup Plugin Framework _plugins = PluginProvider.Startup(config => { config.HostingEnvironment = environment; config.ConfigurationRoot = _configuration; config.LoggerFactory = _loggerFactory; config.AssemblyFolder = _configuration.GetValue <string>("PluginFolder"); config.ConnectionString = _configuration.GetConnectionString("ConnectDB"); }); }
/// <summary> /// 加载指定插件 /// </summary> /// <param name="onloadCall">是否是飞鸽传书初始化时候的请求</param> internal bool LoadService(bool onloadCall) { if (PluginProvider == null || State == PluginState.Running || !PluginProvider.CheckCanLoad(onloadCall) || (!PluginProvider.SupportLoad && !onloadCall)) { return(false); } else { PluginProvider.Startup(); State = PluginState.Running; return(true); } }