Try again

200512270453934121.gif

博客园 首页 联系 管理

The Enterprise Library Data Access Application Block, version 1.0, simplifies development tasks that implement common data access functionality. Applications can use the 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 includes support for both stored procedures and in-line SQL. Common housekeeping tasks such as managing connections and creating and caching parameters are encapsulated in the application block's methods. In other words, the Data Access Application Block provides access to the most often used features of ADO.NET in simple-to-use classes, boosting developer productivity.

数据访问应用块的企业应用库简化了开发任务,其实现了一般的数据访问功能。应用程序可以使用应用块在各种环境中,如为了显示而读数据,通过应用层传递数据,提交改变了的数据到数据库系统。应用块也包括对存储过程和内连SQL的支持。一般的管理任务如连接管理,创建,和缓存参数被封装在应用块的方法中。换句话说,数据访问块提供了访问ADO.NET经常使用的方法,只需要简单的使用类,加强开发者的生产力。

In addition, by using an abstract base class that defines a common interface and provides much of the implementation for the data access methods, the application block allows application code to be portable—it remains uniform across multiple database servers, including Microsoft SQL Server, Oracle, and DB2. Applications written for one type of database—such as SQL Server—look the same as applications written for another type of database, such as Oracle. By using the Data Access Application Block and by following the guidelines in this document, your code remains mostly portable.

此外,通过使用抽象基类,其定义了一般的接口也提供了一些数据访问方法的实现,这个应用块允许应用代码便更加便利,它保持统一的特征去访问多个数据库服务,如sql server ORACLEDB2。每一个应用对应一种数据库,如SQL SERVER—看起来和另一个应用的数据库一样如ORACLE 通过使用数据访问块和遵循文档中的向导,你的代码保持更加简明。

Another feature is that application code can refer to particular databases by name, such as "Customer" or "Inventory." Each named database has its connection information stored in a configuration file. Changing the settings in the configuration file allows developers to use their applications with different database configurations, without having to recompile their code.

The Data Access Application Block provides the following benefits:

另一个特征是,应用代码按名来参考数据库,如"Customer" or "Inventory。每一个命名的数据库有其自己的连接信息存放在配制文件中,在配制文件中改变这些环境允许开发者通过不同的数据库配制使用他们的应用。而不用重新编译它们的代码。

 

 

 

 

 

·                 It reduces the need to write boilerplate code to perform standard tasks.

·                 It helps maintain consistent data access practices, both within an application and across the enterprise.

·                 It reduces difficulties in changing the physical database target.

·                 It relieves developers from learning different programming models for different types of databases.

·                 It reduces the amount of code that needs to be rewritten when porting applications to different types of databases.

·                 它减少了必须写对于标准任务写样本代码的任务

·                 帮助维护数据访问的一致性的实践,在一个应用内和跨企业。

·                 它降低了改变物理数据库的困难。

·                 它解除了开发者为不同的数据库必须学习不同的编程模型。

·                 它减少了重复的代码量。对于不同类型的数据库

Common Scenarios

Developers often write applications that use databases. Because it is so common, developers may find themselves writing the same code over and over for each application. In addition, these applications may need to work with different types of databases. Although the tasks are the same, the code must be adapted to suit the programming model of each database. The Data Access Application Block solves these problems by providing the logic to perform the most common data access tasks. Developers only need to do the following:

开发者经常使用数据库的应用,因为这是如此的平常。开发者可能发现他们自己写同样的代码在每一个数据库中一遍又一遍。此外,这些应用可能需要在不同的数据库上工作。尽管每一个任务是相同的,代码必须适应每一个数据库的编程模型。数据访问应用块解决了这个问题通过提供执行逻辑在一般的数据访问任务中,开发者只需要作下面的事情。

1.            Create the database object. 建立数据对象

2.            Supply the parameters for the command, if they are needed. 如果需要,提供每一个命令的参数

3.            Call the appropriate method. 调用合适的方法

These methods are optimized for performance. They are also portable. The Data Access Application Block works transparently with SQL Server, DB2, and Oracle databases.

这些方法在性能方法是优化的。它们也是便利的。数据访问块工作是透明的,对于SQL Server, DB2, and Oracle databases.

 

 

 

Audience Requirements

This guide is intended for software architects and software developers. To benefit fully from this guide, you should have an understanding of the following technologies:

这个指南确定了软件开发的架构和软件开发者。为了从这个指南中充分受益,你必须完全理解下面的技术。

·                 Microsoft Visual C# development tool or Microsoft Visual Basic development tool

·                 C#开发工具或VB开发工具

·                 .NET Framework

·                 Microsoft SQL Server, Oracle, or DB2 databases

Highlights of Version 1.0 Release

The Enterprise Library 1.0 release of the Data Access Application Block includes the following new features:数据访问块的企业应用库包含以下特征。

·                 It includes a graphical tool for managing configuration settings. 它包含图形工具来管理配制环境。

·                 It includes support for multiple database systems, with the ability to add additional systems. 它支持多数据库系统,添加辅助系统的能力。

·                 It includes a factory and named instances that abstract the database and the connection string, respectively. This lets you include named instances in your application code. These are associated with connection strings using configuration settings. You can modify connection string settings and switch to different databases and database types simply by changing these settings. You do not need to recompile your code.

·                 它包括一个工厂和一个命名实例。这个命名实例抽象了数据库和连接字符串。这可以让你把命名实例包含在应用代码中。这使用配制环境使其与连接字符串相联系。你可以选择连接字符串去选择不同的数据库,数据库类型通过简单的改变,你不需要重新编译你的代码。

·                 It includes support for parameter caching has been expanded to allow applications to clear the cache. 它包含了参数缓存的支持。已经扩展到允许应用清空缓存。

Migrating from Previous Versions of the Data Access Application Block从先前版本的移植。

Users of earlier releases of the Data Access Application Block should recognize many of the scenarios addressed by the Enterprise Library version. While the current version builds on the knowledge and feedback gained from earlier releases, it represents a significant change in how those scenarios are addressed.

早期的数据访问应用块的用户应用意识到很多场景已经定位到企业库版本。当前的版本建立于早期版本的反馈。它代表了一个有意义的改变

The following list describes the changes between the Enterprise Library version of the Data Access Application Block and earlier versions.下面列表是对早期版本和企业库之间的改变的描述。

·                 The static helper methods available in the earlier application block have been replaced by methods on instantiated data access objects. 早期版本的helper方法已经被数据访问对象的实例所代替。

·                 Another style of overloads that accepts new data access objects is now provided. When using this style, all data access functionality is exposed through two overloads, one to use when executing commands outside of a transaction and another to use when executing commands inside of a transaction. 现在的数据访问对象的有另一种形式的重载。当使用这种形式时,所有的访问功能通过两个重载被暴露。一个是外置事务,一个内置事务。

·                 The numerous overloads for each data access method have been reduced. 每一个数据访问方法重载的数量被减少了。

·                 The database-specific object is created with a factory, which uses configuration information to determine the type of object to create.

·                 专用的数据库对象在工厂中创建,通过使用配制信息来决定创建的类型。

·                 Connection string information has been moved to a configuration file and is no longer used on the method calls.

·                 连接信息被放到了配制文件中,不在用方法调用。

·                 A separate class now represents command information. Developers create and initialize a command object, which is then passed to the appropriate method in the Database class.

·                 一个单独的类代表着命令信息。开发者只需要创建和初使化一个命令对象,传到合适的数据库类中。

System Requirements

To run the Data Access Application Block, you need the following:

·                 Microsoft Windows 2000, Windows XP Professional, or Windows 2003 operating system

·                 Microsoft .NET Framework 1.1

·                 Microsoft Visual Studio 2003 development system

·                 A database server running SQL Server 7.0 or later, Oracle 9i, or DB2

·                 If you are using a DB2 database, the IBM UDB 8.1.2 data provider

Data Access Application Block Dependencies

The Data Access Application Block depends on other application blocks and code included in the Enterprise Library:数据访问应用块依赖于别一个应用块,其包含在企业库中。

·                 The Configuration Application Block. The Data Access Application Block uses this to read its configuration information. 数据访问就块使用这个去读取配制信息。

·                 Common library functionality, such as instrumentation. This provides various functions for exposing events and data used for system management. 这个提供了很多的暴露了许多数据和事件的功能,为了系统的管理。

In addition, the application block uses XML files to store configuration information. The recommended way to modify this information is to use the Enterprise Library Configuration Tool.

此外,应用块使用XML文件来存储配制信息。推荐的方法是使用企业库配制工具来改变配制信息。

 

posted on 2005-05-20 09:58  共同学习,共同进步  阅读(454)  评论(0编辑  收藏  举报