Exemple #1
0
            protected override IServiceProvider Build(IServiceCollection builder)
            {
                var sp = base.Build(builder);

                _modulos.Configure(sp);
                return(sp);
            }
            public void Configure(IApplicationBuilder app)
            {
                var pipelineParameters = new object[]
                {
                    app
                };

                modulos.Configure(app.ApplicationServices, pipelineParameters);
            }
Exemple #3
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IHostApplicationLifetime lifetime)
        {
            modulos.Configure(app.ApplicationServices);

            lifetime.ApplicationStopping.Register(() => { modulos.Dispose(); });

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.UseRouting();

            app.UseAuthorization();

            app.UseEndpoints(endpoints => { endpoints.MapControllers(); });
        }
Exemple #4
0
        private static void Main()
        {
            // 1. initialize
            var modulosApp = new ModulosApp();
            var iniResult  = modulosApp.Initialize();


            // 2. organize dependency injection
            var sc = new ServiceCollection();

            sc.AddModulos
            (
                modulosApp,
                // data from initialization pipeline, will be available for DI containers
                iniResult.GetAll()
            );
            var sp = sc.BuildServiceProvider();

            // 3. configure after dependency injection
            modulosApp.Configure(sp);
        }