Пример #1
0
        // This method gets called by the runtime. Use this method to add services to the container.
        // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
        public void ConfigureServices(IServiceCollection services)
        {
            var moudules = PluginExtensions.GetPluginSources <PluginModule>();

            services.AddApplication <HostModule>(o =>
            {
                o.PlugInSources.AddRange(moudules);
            });

            PluginLoadContext.ShowTips = true;

            services.AddMvc().ConfigureApplicationPartManager(apm =>
            {
                foreach (var type in moudules)
                {
                    foreach (var part in new DefaultApplicationPartFactory().GetApplicationParts(type.Assembly))
                    {
                        apm.ApplicationParts.Add(part);
                    }
                }

                foreach (var pluginRazor in PluginExtensions.GetPluginRazors())
                {
                    apm.ApplicationParts.Add(pluginRazor);
                }
            });

            AddControllers(services);
        }