Asynchronous data access layer
You'll find the code for the asynchronous data access layer in the downloaded code bundle, in the folder ThreadStarvation_Db_Async
. A synchronous version is in folder ThreadStarvation_Db_Sync
. Use the SQL scripts tuneup.database.sql
and book.table.sql
to create the database and books table used in the code. Don't forget to modify the connection string in web.config
so that it uses your database server.
Usage
To keep it simple, the asynchronous data layer will access one database table containing books, and it will support only one method, which gets a book by its bookId
. Given the overall structure, it should be easy to extend this layer and modify it for your own needs.
Don't forget to set Async="true
" and set AsyncTimeout
to a timeout in seconds in the Page
directive of each page where you use asynchronous operations:
<%@ Page Language="C#" Async="true" AsyncTimeout="30" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
A typical...