Search code examples
enterprise-library

Why use enterprise library Data Application Block


Can anyone tell me why i should use the Enterprise library Data application block as opposed to using standard ado classes such as SqlConnection,SqlCommand etc??? also if using Enterprise Library how should these connections,adapters be created. i.e. using the using statements all the examples i have seem do not use using statements and so need to do try and finally which contains connection.close etc.


Solution

  • The major advantage of using the Data Access block, besides the simplicity achieved through the encapsulation of the boilerplate code that you would otherwise need to write, is that it provides a way to create provider-independent applications that can easily be moved to use a different source database type. In most cases, unless your code takes advantage of methods specific to a particular database, the only change required is to update the contents of your configuration file with the appropriate connection string. You don’t have to change the way you specify queries (such as SQL statements or stored procedure names), create and populate parameters, or handle return values.

    Take a look here