Example #1
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddDbContext <DB>(options =>
                                       options.UseSqlServer(_configurationRoot.GetConnectionString("HotWheelsConnection")));

            services.AddTransient <ISanPham, RSanPham>();
            services.AddTransient <IThuongHieu, RThuongHieu>();
            services.AddTransient <ITaiKhoan, RTaiKhoan>();

            services.AddSingleton <IHttpContextAccessor, HttpContextAccessor>();
            services.AddScoped(sp => GioHang.LayGioHang(sp));
            services.AddTransient <IDonHang, RDonHang>();

            services.AddMvc();
            services.AddDistributedMemoryCache();
            services.AddSession();
        }
Example #2
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddDbContext <CSDL>(options =>
                                         options.UseSqlServer(_configurationRoot.GetConnectionString("LuciferSneakerConnection")));

            services.AddTransient <InterfaceGiay, RepositoryGiay>();
            services.AddTransient <InterfaceLoaiGiay, RepositoryLoaiGiay>();
            services.AddTransient <InterfaceTaiKhoan, RepositoryTaiKhoan>();

            services.AddSingleton <IHttpContextAccessor, HttpContextAccessor>();
            services.AddScoped(sp => GioHang.LayGioHang(sp));
            services.AddTransient <InterfaceDonHang, RepositoryDonHang>();

            services.AddMvc();
            services.AddDistributedMemoryCache();
            services.AddSession();
        }