// This method gets called by the runtime. Use this method to add services to the container. // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940 public void ConfigureServices(IServiceCollection services) { services.AddMvc(); services.AddDbContext <LittlePacktBookStoreDbContex>(DbContextOptionBuilder => DbContextOptionBuilder.UseSqlServer("Server=(localdb)\\MSSQLLocalDB;Database=LittlePackt;Trusted_Connection=True;MultipleActiveResultSets=true")); services.AddScoped <IRepository <Book>, SqlBooksRepository>(); services.AddScoped <IRepository <Carousel>, CarouselRepository>(); services.AddScoped <IRepository <Order>, SqlOrdersRepository>(); }
protected override void onConfiguring(DbContextOptionBuilder opt) { optionBuilder.UseSqlServer("") base.onConfiguring(optionBuilder); }