Summary: Data Access Application Block is a. NET component that contains optimized data access code to help users invoke stored procedures and issue SQL text commands to SQL Server databases. It returns SqlDataReader, datasets, and XmlReader objects. You can use it as a building block in your own. NET application to reduce the number of custom code that you need to create, test, and maintain. You can download the full C # and Visual Basic. NET source code as well as the consolidated documentation.
Brief introduction
Are you working on the design and development of. NET Application data access code? Do you feel like you're always writing the same data access code over and over again? Have you ever wrapped your data access code in a Helper function so that you can call a stored procedure on a single line? If so, what about Microsoft? The Data Access Application Block for. NET is designed for you.
Data Access Application Block encapsulates the best experience in performance and resource management for accessing Microsoft SQL Server databases. You can easily use it as a building block in your. NET applications, reducing the number of custom code you need to create, test, and maintain from the page.
In particular, Data Access Application Block can help you:
Invokes a stored procedure or SQL text command. Specifies the parameter details. Returns a SqlDataReader, DataSet, or XmlReader object. For example, in an application that references the Data Access application block, you can simply call a stored procedure and generate a DataSet in one line of code, as follows:
[Visual Basic]
Dim ds As DataSet = SqlHelper.ExecuteDataset( _
connectionString, _
CommandType.StoredProcedure, _
"getProductsByCategory", _
new SqlParameter("@CategoryID", categoryID))
[C#]
DataSet ds = SqlHelper.ExecuteDataset(
connectionString,
CommandType.StoredProcedure,
"getProductsByCategory",
new SqlParameter("@CategoryID", categoryID));
Note: Application block for. NET (application blocks for. NET) is designed based on a detailed study of successful. NET applications. It is provided as source code, you can use it as is, or you can customize it for your own application. The application block does not represent the direction of future Microsoft ado.net libraries. The Microsoft Ado.net Library is built to achieve precise control over data access behavior in a variety of uses. Future versions of Ado.net may use different models to implement this scenario.
The remainder of this overview includes the following sections:
What does the Data Access application block contain?
Download and install the Data Access Application Block
Using the Data Access Application Block
Internal design
Problems
Feedback and Support
Collaborators
What does the Data Access application block contain?
Provides the source code for the Data Access Application Block and the QuickStart sample application that you can use to test its functionality. The Data Access Application Block also includes a comprehensive document to help you use and understand the code you provide.
Visual Studio. NET Project
Provides Microsoft visual Basic. NET and Microsoft Visual C # for Data Access Application Block. Source code, and QuickStart sample client applications for each language, you can use these applications to test common scenarios. This helps to deepen your understanding of how the Data Access Application Block works. You can also customize the source code to suit your needs.
You can compile Visual Basic and C # Microsoft.ApplicationBlocks.Data projects to generate an assembly named Microsoft.ApplicationBlocks.Data.dll. The assembly includes a SqlHelper class (which contains core functionality for executing database commands) and a SqlHelperParameterCache class (which provides parameter discovery and caching capabilities).