Avoid Wrapping DbContext in Using (and other gotchas)

added by DotNetKicks
12/2/2020 3:49:20 AM

836 Views

Date Published: 01 December 2020 EF and EF Core DbContext types implement IDisposable. As such, best practice programming suggests that you should wrap them in a using() block (or new C# 8 using statement). Unfortunately, doing this, at least in web apps, is generally a bad idea.


0 comments