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 an开发者_StackOverflowd so need to do try and finally which contains connection.close etc.
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
There are a bunch of reasons to use a known solution. A few reasons are that it will allow you to... spend less time writing potentially tedious code, and you'll be using code that has already been thoroughly tested. You'll also have more time to work on more important parts of the project.
Enterprise Library is a lot of code, you will need to map manually all the entities, and many operation uses stored procedures that can complicate your migration to another database, that is what Grigory didn't say. I suggest you use an ORM like linqtodb, it is a nice option, faster to learn, fast to get data and support the most of the databases.
精彩评论