Пример #1
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public IServiceProvider ConfigureServices(IServiceCollection services)
        {
            services.AddControllers();

            services.AddDbContext <UpsLightContext>(options =>
                                                    options.UseSqlServer(Configuration.GetConnectionString("UpsLightDb")));

            services.AddHttpContextAccessor();
            var serviceProvider = services.BuildServiceProvider();

            IExecutionContextAccessor executionContextAccessor = new ExecutionContextAccessor(serviceProvider.GetService <IHttpContextAccessor>());


            // pass the services to Service project
            return(ApplicationStartup.Inizialize(services, executionContextAccessor));
        }