question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

async/await all the way

See original GitHub issue

I’m not sure if this project would benefit from async/await support.

I have the vague feeling that it might be better to go async/await, because DB-oriented libraries will go async-first (in the future) and simply use .Wait() for the non-async functions. On the other hand, we’re usually not blocking the application/server, because the migrations will usually be done beforehand manually (migration tool) or at startup.

Here is what I found out about the ADO.NET providers:

ADO.NET provider Version Direct async support
FirebirdSql.Data.FirebirdClient 6.0.0-beta1 No
Npgsql 4.0.0-preview2 Yes
System.Data.SqlClient 4.4.3 Yes 1
System.Data.SQLite 1.0.108 No
MySql.Data 8.0.10-rc No 2
Oracle.ManagedDataAccess 12.2.1100 No
IBM.Data.DB2 11.1.3030.4 No
Sap.Data.Hana.v4.5 2.2.36.0 No 3

1 Creates async tasks by wrapping the old-style Begin*/End* functions 2 Provides Begin*/End* functions for some platforms, but no *Async functions 3 Provides Begin*/End* functions and (partially) *Async, but executes the queries synchronously

Every ADO.NET provider gains some kind of async support through DbCommand, but this might not be as performant as it could’ve been.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:8
  • Comments:18

github_iconTop GitHub Comments

1reaction
Pretasoccommented, Jun 7, 2020

So to conclue this: I will draft a proposal how async support could be realized. AS im currently very busy at my daytimer job, I doubt i can show something before next weekend.

1reaction
jzabroskicommented, Apr 26, 2019

I have found a use case for async/await:

In the terminal, Control+C to cancel the migration pipeline. Without a CancellationToken to pass, there is no good way other than closing the terminal to do this

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why use Async/await all the way down
So async all the way up enables you to actually make an asynchronous call and release any threads. If it isn't async all...
Read more >
Async/Await - Best Practices in Asynchronous Programming
“Async all the way” means that you shouldn't mix synchronous and asynchronous code without carefully considering the consequences. In particular, it's usually a ......
Read more >
Long Story Short: Async/Await Best Practices in .NET
Async all the way. As you start working with async methods, you will quickly realize that the asynchronous nature of the code starts...
Read more >
10 Best Practices in Async-Await Code in C# in [2022]
10 Best Practices in Async-Await Code in C# in [2022] · #1 Use and await asynchronous methods, if possible · #2 Avoid async...
Read more >
Best Practices for Using async and await, by Damir Arh
The async and await keywords have been a part of the C# programming language for a long time. Despite that, they still hide...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found