Example #1
0
        /// <summary>
        /// 手动加载插件,解决IL无法调试功能
        /// </summary>
        /// <param name="services"></param>
        /// <param name="builder"></param>
        /// <param name="plugins"></param>
        /// <param name="pluginPath"></param>
        public static void InitWebApiPlug(this IServiceCollection services, IMvcBuilder builder, IList <IPlugin> plugins, string pluginPath)
        {
            ConfigHelper._PlugPath = pluginPath;
            IPluginFactory plugFactory = new DefaultWebApiPluginFactory(builder);

            Task.Factory.StartNew(() =>
            {
                var dllPluginList = plugFactory.GetPluginList(pluginPath);
                if (plugins != null)
                {
                    plugins.Foreach((item) =>
                    {
                        if (item != null && !dllPluginList.Any(f => f.PluginID == item.PluginID))
                        {
                            dllPluginList.Add(item);
                        }
                    });
                }
                plugFactory.Load(dllPluginList);
            }).ContinueWith((obj) =>
            {
                PluginManager.InitExcute(pluginPath, builder);
            }).ContinueWith((obj) =>
            {
                IocUnity.AddSingleton <SessionManager>(new SessionManager(IocUnity.Get <ICache>()));
            }).Wait();
        }
Example #2
0
        public static void InitWebApiPlug(this IServiceCollection services, IMvcBuilder builder, string pluginPath)
        {
            ConfigHelper._PlugPath = pluginPath;
            IPluginFactory plugFactory = new DefaultWebApiPluginFactory(builder);

            Task.Factory.StartNew(() =>
            {
                plugFactory.Load(pluginPath);
            }).ContinueWith((obj) =>
            {
                PluginManager.InitExcute(pluginPath, builder);
            }).ContinueWith((obj) =>
            {
                IocUnity.AddSingleton <SessionManager>(new SessionManager(IocUnity.Get <ICache>()));
            }).Wait();
        }