public static void HotSetup(this IServiceCollection services, IMvcBuilder mvcBuilder)
        {
            _serviceCollection = services;
            services.AddSingleton <IHttpContextAccessor, HttpContextAccessor>();
            services.AddSingleton <IMvcModuleSetup, MvcModuleSetup>();
            services.AddSingleton <IServiceCollection>(services);
            // services.AddScoped<IDbHelper, DbHelper>();
            services.AddSingleton <IActionDescriptorChangeProvider>(InBizActionDescriptorChangeProvider.Instance);
            services.AddSingleton <IReferenceContainer, DefaultReferenceContainer>();
            services.AddSingleton <IReferenceLoader, DefaultReferenceLoader>();
            services.AddSingleton(InBizActionDescriptorChangeProvider.Instance);
            // IMvcBuilder mvcBuilder = services.AddMvc();
            ServiceProvider provider = services.BuildServiceProvider();

            using (IServiceScope scope = provider.CreateScope())
            {
                var contextProvider = new CollectibleAssemblyLoadContextProvider();
                var context         = contextProvider.Get("DemoPlugin1", services, mvcBuilder.PartManager, scope);
                if (context != null)
                {
                    PluginsLoadContexts.Add("DemoPlugin1", context);
                }
            }
            AssemblyLoadContextResoving();
            services.Configure <RazorViewEngineOptions>(o =>
            {
                o.AreaViewLocationFormats.Add("/Modules/{2}/Views/{1}/{0}" + RazorViewEngine.ViewExtension);
                o.AreaViewLocationFormats.Add("/Views/Shared/{0}.cshtml");
            });

            services.Replace <IViewCompilerProvider, InBizViewCompilerProvider>();
        }
        public override void ConfigureServices(ServiceConfigurationContext context)
        {
            context.Services.TryAddSingleton <InBizModuleLoader>();
            context.Services.TryAddSingleton <IHttpContextAccessor, HttpContextAccessor>();
            context.Services.TryAddSingleton <IMvcModuleSetup, MvcModuleSetup>();
            context.Services.TryAddSingleton <IReferenceContainer, DefaultReferenceContainer>();
            context.Services.TryAddSingleton <IReferenceLoader, DefaultReferenceLoader>();

            ServiceProvider provider    = context.Services.BuildServiceProvider();
            var             partManager = context.Services.GetSingletonInstance <ApplicationPartManager>();

            using (IServiceScope scope = provider.CreateScope())
            {
                var contextProvider = new CollectibleAssemblyLoadContextProvider();
                var pluginContext   = contextProvider.Get("DemoPlugin2", context.Services, partManager, scope);
                PluginsLoadContexts.Add("DemoPlugin2", pluginContext);
            }
            AssemblyLoadContextResoving();
            Configure <AbpAspNetCoreMvcOptions>(options =>
            {
                options.ConventionalControllers.Create(typeof(InBizModuleAppliction).Assembly);
            });
            Configure <RazorViewEngineOptions>(o =>
            {
                o.AreaViewLocationFormats.Add("/Modules/{2}/Views/{1}/{0}" + RazorViewEngine.ViewExtension);
                o.AreaViewLocationFormats.Add("/Views/Shared/{0}.cshtml");
            });
            context.Services.Replace <IViewCompilerProvider, InBizViewCompilerProvider>();
        }
 private static void AssemblyLoadContextResoving()
 {
     AssemblyLoadContext.Default.Resolving += (context, assembly) =>
     {
         Func <CollectibleAssemblyLoadContext, bool> filter = p => p.Assemblies.Any(p => p.GetName().Name == assembly.Name &&
                                                                                    p.GetName().Version == assembly.Version);
         if (PluginsLoadContexts.All().Any(filter))
         {
             Assembly ass = PluginsLoadContexts.All().First(filter)
                            .Assemblies.First(p => p.GetName().Name == assembly.Name &&
                                              p.GetName().Version == assembly.Version);
             return(ass);
         }
         return(null);
     };
 }