// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { string connection = Configuration.GetConnectionString("DefaultConnection"); services.AddDbContext <ApplicationContext>(options => options.UseSqlServer(connection)); // установка конфигурации подключения services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme) .AddCookie(options => //CookieAuthenticationOptions { options.LoginPath = new Microsoft.AspNetCore.Http.PathString("/Account/Login"); }); services.AddControllersWithViews(); services.AddDbContext <AppDBContent>(options => options.UseSqlServer(_confstring.GetConnectionString("DefaultConnection"))); services.AddTransient <IAFunctions, FunctionsRepository>(); services.AddTransient <IFunctionsManager, CategoryRepository>(); services.AddTransient <IAllOrders, OrdersRepository>(); services.AddSingleton <IHttpContextAccessor, HttpContextAccessor>(); services.AddScoped(sp => NPage.GetCart(sp)); services.AddMvc(); services.AddMemoryCache(); services.AddSession(); services.AddControllersWithViews(); services.AddDbContext <ApplicationContext>(options => options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection"))); services.AddIdentity <Order, IdentityRole>() .AddEntityFrameworkStores <ApplicationContext>(); services.AddControllersWithViews(); }