'How to prevent EF core 5 from creating a savepoint when saving

We're using EF Core within a context where we always manage the transaction externally. We also have to use MARS. This combination causes the following warning since we've upgraded to EF Core 5:

Microsoft.EntityFrameworkCore.Database.Transaction - Savepoints are disabled because Multiple Active 
Result Sets (MARS) is enabled. If 'SaveChanges' fails, then the transaction cannot be automatically 
rolled back to a known clean state. Instead, the transaction should be rolled back by the application 
before retrying 'SaveChanges'. See https://go.microsoft.com/fwlink/?linkid=2149338 for more information. 
To identify the code which triggers this warning, call 'ConfigureWarnings(w => 
w.Throw(RelationalEventId.SavepointsDisabledBecauseOfMARS))'.

I'm fine with Savepoints being disabled (at least for now), but I'm not so happy with a logmessage for every database save...

Is there a way to tell EF Core to not use this new feature?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source