Пример #1
0
        public void ConfigureServices(IServiceCollection services)
        {
            JwtAuth.SetAuthService(services);

            services.AddOcelot(Configuration);
            services.AddCors();
        }
Пример #2
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddControllers();

            services.AddScoped <IRepositoryContextFactory, RepositoryContextFactory>();
            services.AddScoped <IOrderRepository>(
                provider =>
                new OrderRepository(Configuration.GetConnectionString("DefaultConnection"),
                                    provider.GetService <IRepositoryContextFactory>())
                );
            services.AddScoped <IOrderItemRepository>(
                provider =>
                new OrderItemRepository(Configuration.GetConnectionString("DefaultConnection"),
                                        provider.GetService <IRepositoryContextFactory>())
                );
            services.AddScoped <ICustomerRepository>(
                provider =>
                new CustomerRepository(Configuration.GetConnectionString("DefaultConnection"),
                                       provider.GetService <IRepositoryContextFactory>())
                );

            services.AddScoped <ICatalogRepository>(
                provider =>
                new CatalogRepository(Configuration.GetConnectionString("DefaultConnection"),
                                      provider.GetService <IRepositoryContextFactory>())
                );

            JwtAuth.SetAuthService(services);
            services.AddCors();
        }