dotnet / SqlClient

Microsoft.Data.SqlClient provides database connectivity to SQL Server for .NET applications.
MIT License
862 stars 290 forks source link

Implement async transaction commit/rollback methods #113

Open roji opened 5 years ago

roji commented 5 years ago

.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

roji commented 5 years ago

(note: these should hopefully also make it into .NET Standard 2.1)

Wraith2 commented 5 years ago

Is there written guidance anywhere on the suggested patterns of do and don't for implementing IAsyncDisposable?

roji commented 5 years ago

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()).

roji commented 4 years ago

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.