About Asynchronous Database Access

The IDatabaseServiceAsync interface (and DatabaseServiceAsync implementation) modify the ADO.NET database accesses provided by Database Abstraction to incorporate the .NET 4.5 async / await paradigm. This does not make ADO.NET suddenly asynchronous; its interfaces (and implementing vendor-specific drivers) are still synchronous libraries. However, the IDatabaseServiceAsync methods make these accesses something that your logic can await. This way, your web server or UI threads will not be waiting for these often I/O-bound or network-bound requests to complete until absolutely necessary; and, when they are waiting, they will not be blocking.

The DatabaseServiceAsync implementation takes a traditional IDatabaseService implementation in its constructor, and wraps the calls as awaitable tasks. The interface also exposes a Service property, which allows for access to the underlying implementation; this way, you can select the mix-and-match approach to synchronous vs. asynchronous programming that works for your project.

The Async code is distributed as a separate DLL, so as to not incur an otherwise-unnecessary dependency on version 4.5 of the .NET framework.

Last edited Apr 1, 2013 at 5:56 PM by danielsummers, version 5

Comments

No comments yet.