DbContext.DisposeAsync Method
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Releases the allocated resources for this context.
public virtual System.Threading.Tasks.ValueTask DisposeAsync ();
abstract member DisposeAsync : unit -> System.Threading.Tasks.ValueTask
override this.DisposeAsync : unit -> System.Threading.Tasks.ValueTask
Public Overridable Function DisposeAsync () As ValueTask
Entity Framework Core does not support multiple parallel operations being run on the same DbContext instance. This includes both parallel execution of async queries and any explicit concurrent use from multiple threads. Therefore, always await async calls immediately, or use separate DbContext instances for operations that execute in parallel. See Avoiding DbContext threading issues for more information and examples.
See DbContext lifetime, configuration, and initialization for more information and examples.
Product | Versions |
---|---|
Entity Framework Core | 3.0, 3.1, 5.0, 6.0, 7.0, 8.0, 9.0 |
Entity Framework feedback
Entity Framework is an open source project. Select a link to provide feedback: