public void SetupExtensions()
        {
            Logger.Information("Start loading extensions...");

            var context = CreateLoadingContext();

            // Notify all loaders about extensions removed from the web site
            foreach (var dependency in context.DeletedDependencies)
            {
                Logger.Information("Extension {0} has been removed from site", dependency.Name);
                foreach (var loader in _loaders)
                {
                    if (dependency.LoaderName == loader.Name)
                    {
                        loader.ExtensionRemoved(context, dependency);
                    }
                }
            }

            // For all existing extensions in the site, ask each loader if they can
            // load that extension.
            foreach (var extension in context.AvailableExtensions)
            {
                ProcessExtension(context, extension);
            }

            // Execute all the work need by "ctx"
            ProcessContextCommands(context);

            // And finally save the new entries in the dependencies folder
            _dependenciesFolder.StoreDescriptors(context.NewDependencies);
            _extensionDependenciesManager.StoreDependencies(context.NewDependencies, desc => GetExtensionHash(context, desc));

            Logger.Information("Done loading extensions...");

            // Very last step: Notify the host environment to restart the AppDomain if needed
            if (context.RestartAppDomain)
            {
                Logger.Information("AppDomain restart required.");
                _hostEnvironment.RestartAppDomain();
            }
        }
        /// <summary>
        /// 安装扩展。
        /// </summary>
        public void SetupExtensions()
        {
            Logger.Information("开始加载扩展...");

            var context = CreateLoadingContext();

            //通知应用程序中的所有装载机有关扩展被删除
            foreach (var dependency in context.DeletedDependencies)
            {
                Logger.Information("扩展 {0} 已从应用程序中删除", dependency.Name);
                var dependencyProxy = dependency;
                foreach (var loader in _loaders.Where(loader => dependencyProxy.LoaderName == loader.Name))
                {
                    loader.ExtensionRemoved(context, dependency);
                }
            }

            //要求所有装载机对应用程序中所有现有可用的扩展进行加载。
            foreach (var extension in context.AvailableExtensions)
            {
                ProcessExtension(context, extension);
            }

            //执行所有需要通过上下文的工作
            ProcessContextCommands(context);

            //保存最新的条目中的依赖关系
            _dependenciesFolder.StoreDescriptors(context.NewDependencies);
            _extensionDependenciesManager.StoreDependencies(context.NewDependencies, desc => GetExtensionHash(context, desc));

            Logger.Information("扩展加载完成");

            //最后一步:如果需要,通知主机环境来重新启动AppDomain。
            if (!context.RestartAppDomain)
            {
                return;
            }
            Logger.Information("AppDomain 需要重新启动。");
            _hostEnvironment.RestartAppDomain();
        }