private StudentDetailContext GetDbContext() { DbContextOptions <StudentDetailContext> options; var builder = new DbContextOptionsBuilder <StudentDetailContext>(); builder.UseInMemoryDatabase(databaseName: "database_name"); options = builder.Options; StudentDetailContext studentDetailContext = new StudentDetailContext(options); return(studentDetailContext); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env, StudentDetailContext context) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseExceptionHandler("/Home/Error"); } app.UseStaticFiles(); context.Database.Migrate(); app.UseRouting(); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapControllerRoute( name: "default", pattern: "{controller=StudentDetails}/{action=Index}/{id?}"); }); }
public CourseDetailController(StudentDetailContext context) { _context = context; }
public EnrollmentService(StudentDetailContext studentDetailContext) { _context = studentDetailContext; }
public StudentDetailsController(StudentDetailContext context) { _context = context; }
public StudentService(StudentDetailContext context) { _context = context; }