コード例 #1
0
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddDbContext <AppDBContent>(options => options.UseSqlServer(_confSting.GetConnectionString("DefaultConnection")));
            services.AddTransient <IALLDishes, DishesRepository>();
            services.AddTransient <IDeshesCategory, CategoryRepository>();
            //services.AddTransient<IALLDishes, MockDishes>();
            //services.AddTransient<IDeshesCategory, MockCategory>();

            services.AddSingleton <IHttpContextAccessor, HttpContextAccessor>();
            services.AddScoped(sp => ShopDisher.GetDisher(sp));

            services.AddMvc();
            services.AddMemoryCache();
            services.AddSession();
        }
コード例 #2
0
 public ShopDisherController(IALLDishes dishesRep, ShopDisher shopDisher)
 {
     _dishesRep  = dishesRep;
     _shopDisher = shopDisher;
 }