You can inherit the DbContext created by the template, define your own constructor, and use the inherited DbContext instead of the one created by the template.
public class MyModifiedDbContext : TheTemplateGeneratedDbContext { public MyModifiedDbContext() {
Or make it private to avoid using it, so you get an error at compile time
public class MyModifiedDbContext : TheTemplateGeneratedDbContext { private MyModifiedDbContext()
Use MyModifiedDbContext instead of TheTemplateGeneratedDbContext
source share