Home Services Partners Company
Make the most of the Data Access Application Blocks

Make the most of the Data Access Application Blocks

October 24, 2007 0 Comments

Shameless plug here today: I've talked about the Data Access Application Blocks here before, but today Connect for ADO.NET released support for the for the DAAB code blocks supplied in the Enterprise Libraries. You can now configure the DAAB with Connect for ADO.NET by following some quick and easy steps - scroll down for details...

The DAAB code blocks do an excellent job at abstracting away ADO.NET coding specifics, if you the architect is looking to shield your developers away from data source variances, particularly in a heterogeneous database environment Add the Connect for ADO.NET providers into the mix you can architect true code data blocks that offer SQL Leveling, best-in class performance and host of other features that bullet proof your blocks for many years to come.

Curious as to how to do this ? Use these instructions sourced from here, this is a quick guide to get your started. Great job from Betsy to get this together in such short space of time:

Configuring the Data Access Application Block consists of two parts:

  • Adding a New DAAB Entry
  • Adding the Data Access Application Block to Your Application

Adding a New DAAB Entry

Now, use the Enterprise Library Configuration Tool to add a new DAAB entry:

  1. Right-click Enterprise Library Configuration, and select New Application.
  2. Right-click Application Configuration, then select New / Data Access Application Block. The Enterprise Library Configuration window appears.Enterprise Library Configuration window, with the Data Access Application Block node expanded
  3. In the Name field, enter a name for the DAAB, for example, MyOracle.
  4. In the ConnectionString field, enter a connection string.
  5. In the ProviderName field, identify the DataDirect data provider:
    1. For DB2, enter DDTek.DB2
    2. For Oracle, enter DDTek.Oracle
    3. For SQL Server, enter DDTek.SQLServer
    4. For Sybase, enter DDTek.Sybase
  6. Right-click Customer Provider Mappings and select New / Provider Mappings.Enterprise Library Configuration window, with Custom Provider Mappings node expanded
  7. In the Name field, type the DAAB name entered in Step 3 (MyOracle).
  8. In the TypeName field, choose the browse (...) button and navigate to the Debug output directory of the DataDirect DAAB that you want to build.
  9. Select the file name, for example, DDTek.EnterpriseLibrary.Data.Oracle.dll, and then click Open.
  10. Leave the Enterprise Library Configuration window open for now. Do not save this configuration until you complete the following section.

Adding the Data Access Application Block to Your Application

To add the DAAB to a new or existing application, perform these steps:

  1. Right-click the project and select Add Reference.
  2. In the Add Reference dialog, select Enterprise Library Shared Library, and click OK.
  3. Right-click the project and select Add Reference.
  4. In the Add Reference dialog, select Enterprise Library Data Access Application Block, and click OK.
  5. Add the following directive to your C# source code:
    using Microsoft.Practices.EnterpriseLibrary.Data;
    using System.Data;
    
  6. Rebuild the solution to ensure that the new dependencies are functional.
  7. Determine the output Debug or Release path location of your current solution, and switch back to the Enterprise Library Configuration window (see "Adding a New DAAB Entry" on page 3).
  8. Right-click the connection string under the Application Configuration node and select Save Application.Enterprise Library Configuration window, with the Connection Strings node expanded
  9. Navigate to the Debug or Release output directory of your current solution, and locate the .exe file of the current solution, for example, MyApp.exe.
  10. Click the file name once, and add .config to the name, for example, MyApp.exe.config.
  11. Ensure Save as type 'All Files' is selected and select Save.
  12. Using File Explorer, copy the DDTek.EnterpriseLibrary.Data.XXX.dll from the DataDirect DAAB directories (where XXX indicates the data source).
  13. Place a copy of this DLL into either the Debug or Release output directory of your current solution.

Jonathan Bruce

View all posts from Jonathan Bruce on the Progress blog. Connect with us about all things application development and deployment, data integration and digital business.

Read next SAS ODBC Access to Salesforce, SQL Server and Marketo
Comments
Comments are disabled in preview mode.