Why we need to pass DbContextOptions in to Context class Constructor in Entity Framework .NET Core?

Forums .NET CoreWhy we need to pass DbContextOptions in to Context class Constructor in Entity Framework .NET Core?
Staff asked 2 years ago

Why we need to pass  DbContextOptions<StudentContext> in to StudentContext Class Constructor ?

My context class as below,

public class StudentContext:DbContext
{
public StudentContext(DbContextOptions<StudentContext> options):base(options)
{

}
public DbSet<Student> Students { get; set; }
}

 

Subscribe

Select Categories