Turn off EF change tracking for any instance of the context [duplicate]
问题 This question already has answers here : Global setting for AsNoTracking()? (5 answers) Closed 6 years ago . I have a context to a read-only database for reporting and I am writing lots of code, like this: using (var context = new ReportingContext()) { var reportXQuery = context.ReportX.AsNoTracking(); // Do stuff here with query... } Is there a way to set the AsNoTracking bit so that just new ing up the ReportingContext above would automatically use AsNoTracking instead of needing to