Microsoft practices enterpriselibrary data db2




















Data, 5. NET Interactive. Copy this into the interactive tool or source code of the script to reference the package. Data as a Cake Addin addin nuget:? Data as a Cake Tool tool nuget:? This package has no dependencies. NuGet packages This package is not used by any NuGet packages. GitHub repositories This package is not used by any popular GitHub repositories. Int32, Category ;. ExecuteDataSet dbCommand ;. GetSqlStringCommand sqlCommand ;. ExecuteReader dbCommand. Append dataReader[ "Name" ] ;.

Append Environment. NewLine ;. Close ;. Int32, productID ;. String, 50 ;. Currency, 8 ;. ExecuteNonQuery dbCommand ;. Format CultureInfo. ExecuteScalar dbCommand ;.

Open ;. BeginTransaction ;. ExecuteNonQuery creditCommand, transaction ;. ExecuteNonQuery debitCommand, transaction ;. Commit ;. The first three sections contain general information on Enterprise Library and its benefits. You can safely skip it if you are acquainted with the matter. Enterprise Library is a set of application blocks - reusable software components designed to help developers with usual enterprise development tasks. Application blocks help solve common problems that developers face from one project to another.

They have been designed to encapsulate the Microsoft recommended best practices for. NET applications. Application blocks can be added to applications quickly and easily.

Applications can use this application block in a variety of situations, such as reading data for display, passing data through application layers, and submitting changed data back to the database system. The application block supports both stored procedures and in-line SQL. Common maintenance tasks, such as managing connections and creating and caching parameters, are encapsulated in the application block's methods.

NET in simple-to-use classes. The Block exposes a model that supports encapsulation of database-specific features, which allows applications to be ported from one database type to another without modifying the client code.

The Data Access Application Block includes a small number of methods that simplify the most common methods of accessing a database. Each method encapsulates the logic required to retrieve the data and manage the connection to the database.

You should consider using the application block if your application uses standard data access techniques. The application block supplements the code in ADO. NET that allows you to use the same code with different database types. NET; it is not a replacement.

The application block provides simplicity and convenience while helping developers use ADO. NET with best practices. If your application needs to retrieve data in specialized way, or if your code needs customization to take advantage of features specific to DB2, using dotConnect for DB2 might suit you better. The rest of the article demonstrates configuring and using Enterprise Library. You can study it in conjunction with this article. The sample represents integral project that demonstrates primary techniques, while the article explains most important points.

All settings are stored in single file, App. No other configuration file is needed. This file App. The following assemblies need to be referenced by the solution: Microsoft. Data and Microsoft.



0コメント

  • 1000 / 1000