I am using the PCL SQLite.NET library for my WinRT projects with a help
SQliteAsyncConnectionthat offers asynchronous versions of classic methods SQLiteConnection. However, the Github project page states the following:
Please note that the template Task.Runused in SQliteAsyncConnectioncan be considered as an anti-template (libraries should not provide asynchronous methods if they really are not asynchronous). This class is supported for backward compatibility and for use where asynchronous isolation is convenient.
Why is use Task.Runin this case considered an anti-pattern? This allows the developer to achieve exactly the goal that he needs - to run the database access code in a separate thread, while the application will respond to user input. Would it be better to manually write a fragment Task.Runevery time and not use the asynchronous version of the class at all?
What are the potential problems and failures of this template?
source
share