Open roji opened 5 years ago
(note: these should hopefully also make it into .NET Standard 2.1)
Is there written guidance anywhere on the suggested patterns of do and don't for implementing IAsyncDisposable
?
I'm not sure there's an "official" guide or anything, but the basic idea is to bring the instance to the same state it would have had if Dispose()
was called, except that all I/O and other blocking calls need to be done asynchronously. The rest is going to depend on your specific implementation (e.g. whether any code can be shared between Dispose()
and DisposeAsync()
).
Note this user complaint about the lack of async transaction APIs: https://github.com/dotnet/efcore/issues/21818. Not sure how complex this is to implement, but I'm hoping it can be done at some point to unblock perf issues such as this.
.NET Core 3.0 will fill in some missing async APIs (e.g. transaction management), these should be implemented in SqlClient at some point.
https://github.com/dotnet/corefx/issues/35012