// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env, QuotesDbContext _context) { MigrateDb(app); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.UseHttpsRedirection(); // Enable middleware to serve generated Swagger as a JSON endpoint. //_context.Database.Migrate(); app.UseResponseCaching(); app.UseSwagger(); // Enable middleware to serve swagger-ui (HTML, JS, CSS, etc.), // specifying the Swagger JSON endpoint. app.UseSwaggerUI(c => { c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1"); }); app.UseRouting(); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapControllers(); }); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env, QuotesDbContext quotesDbContext) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseExceptionHandler("/Home/Error"); app.UseHsts(); } app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseRouting(); app.UseAuthorization(); // quotesDbContext.Database.EnsureCreated(); app.UseEndpoints(endpoints => { endpoints.MapControllers(); }); app.UseResponseCaching(); app.UseAuthentication(); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, QuotesDbContext quotesDbContext) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseHsts(); } app.UseHttpsRedirection(); quotesDbContext.Database.EnsureCreated(); app.UseMvc(); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, QuotesDbContext quotesDbContext) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseHsts(); } app.UseHttpsRedirection(); // quotesDbContext.Database.Migrate(); app.UseResponseCaching(); // 2. Enable authentication middleware app.UseAuthentication(); app.UseMvc(); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env, QuotesDbContext quotesDbContext) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.UseHttpsRedirection(); quotesDbContext.Database.EnsureCreated(); app.UseRouting(); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapControllers(); }); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, QuotesDbContext dbContext) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseHsts(); } //dbContext.Database.EnsureCreated(); // comment out if using migrations app.UseResponseCaching(); // Enable authentication middleware app.UseAuthentication(); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); }); // Enable authentication middleware app.UseAuthentication(); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); }); app.UseHttpsRedirection(); app.UseMvc(); }
public HomeController(ILogger <HomeController> logger, QuotesDbContext con) { _logger = logger; Context = con; }
public HomeController(ILogger <HomeController> logger, QuotesDbContext ctx) { _logger = logger; context = ctx; }
public QuotesController(QuotesDbContext dbContext) { quotesDbContext = dbContext; }
public CreateQuoteModel(QuotesDbContext db) { _db = db; }
public EditModel(QuotesDbContext db) { _db = db; }
public QuotesController(QuotesDbContext context) { this.context = context; }
public DbQuotesRepository(QuotesDbContext db) { _db = db; }
public PersonController(QuotesDbContext quotesDbContext) { _QuotesDbContext = quotesDbContext; }
public QuoteRepository(QuotesDbContext context, EmailSender emailSender) { _context = context; _emailSender = emailSender; }
public QuotesListModel(QuotesDbContext db) { _db = db; }
public IndexModel(QuotesDbContext db) { _db = db; }
public ElementRepository(QuotesDbContext quotesDbContext) { _quotesDbContext = quotesDbContext; }
public HomeController(ILogger <HomeController> logger, IQuotesRepository repository, QuotesDbContext context) { _logger = logger; _context = context; _repository = repository; }
public QuoteRepository(QuotesDbContext dbContext) { _dbContext = dbContext; }
/*Not sure where yet but the dbcontext object with the options is being injected here. * this constructor uses the QuotesDbContext referenced in the (Startup.cs)ConfigureServices to * resolve this dependency(Also most likely uses IOC)*/ public QuotesController(QuotesDbContext quotesDbContext) { _quotesDbContext = quotesDbContext; }
public TagsController(QuotesDbContext context) { _context = context; }