6 The DB2 Entity Framework Data Provider : Configuring the DB2 Entity Framework Data Provider

Configuring the DB2 Entity Framework Data Provider
The Entity Framework data provider uses the functionality defined by the DB2 data provider. See Chapter 5 “The DB2 Data Provider” for detailed information on information common to both types of DB2 data providers. However, because of functionality that is provided by the ADO.NET Entity Framework, some configuration differences are required.
NOTE: The performance and behavior of the EdmGen and Visual Studio tools, when using the DB2 Entity Framework data provider to create and manipulate ADO.NET Entity Data Models, can be impacted by the data provider configuration options.
You can configure specific behavior for the Entity Framework data provider in several ways:
Adding the Provider Schema Attribute
Provider is an attribute of the Schema element in the storage model file of an Entity Data Model (EDM). The storage model file is written in the store schema definition language (SSDL).
The Entity Data Model wizard assigns the value when you select the DB2 data provider. If you are manually defining an Entity Data Model, assign the string DDTek.DB2 to the Provider attribute of the Schema element, as shown in the following example for DB2 iSeries V6R1:
<Schema Namespace="AdventureWorksModel.Store" Alias="Self" Provider="DDTek.DB2" ProviderManifestToken="DB2iSeries" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" xmlns="http://schemas.microsoft.com/ado/2006/04/edm/ssdl">
Modifying the Configuration File
The Entity Framework data provider defines a number of configuration options that enable you to customize the behavior of the data provider to meet your functional or performance needs. Configuration options are defined in configuration files. The following table summarizes the characteristics of configuration files in which you may want to specify options.
 
The following table provides the typical locations for the configuration files.
 
Refer to the DataDirect Connect Series for ADO.NET Distribution Guide for information about deployed applications.
The following code fragment shows the syntax and default values:
<ddtek.db2.entity
   edmSchemaRestrictions="AccessibleExcludingList"
    enableLoggingApplicationBlock="False"
/>
Table 6-6 lists the mapping of the configuration file options to their default values.
 
The following configuration option descriptions are listed alphabetically.
edmSchemaRestrictions
Description
Restricts or expands the database objects available to you when generating a model from a database. The option filters the schema objects that are returned when building the EDM that your application includes. Restricting the objects can also provide a performance improvement.
You can add or install the EdmSchemaRestrictions option entry in the app.config or web.config file.
Building large models with the Entity Data Model (EDM) can be very inefficient. For optimal results, consider breaking up a model when it has reached 50 to 100 entities. In addition, carefully consider which objects are actually needed in the model.
Valid Values
User | Accessible | AccessibleExcludingList
When set to User, the data provider limits the objects available for the model to those for which the current user is the owner.
When set to Accessible, the model is built against a larger subset.
When set to AccessibleExcludingList, all the schema objects for which the current user has access are returned, less a predefined list of system-related schema.
Default
User
enableLoggingApplicationBlock
Type
Attribute
Description
Enables the Logging Application Block. Refer to the DataDirect Connect Series for ADO.NET Reference for information on using Logging Application Blocks.
Valid Values
True | False
When set to True, the Logging Application Block is enabled.
Default
False
labAssemblyName
Type
Attribute
Description
Specifies the version of the Enterprise Library Logging Application Block. By default, the Entity Framework data providers use the Enterprise Library 5.0 Logging Application Block.
NOTE: If you are using any version of the LAB other than the Microsoft Enterprise Library 5.0 binary release, you must set the labAssemblyName. For example, if you are using an older or newer version of the LAB, or a version that you have customized, you must specify a value for labAssemblyName.
Valid Values
string
where string is the name of the Enterprise Library Logging Application Block that you want to use.
Default
The Enterprise Library 5.0 Logging Application Block:
Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL
labLogEntryTypeName
Type
Attribute
Description
Specifies the LogEntry type name for the LogEntry object.
Valid Values
string
Where string is the LogEntry type name.
Default
Microsoft.Practices.EnterpriseLibrary.Logging.LogEntry
labLoggerTypeName
Type
Attribute
Description
Specifies the Logger type name for the Logging Application Block.
Valid Values
string
Where string is the Logger type name.
Default
Microsoft.Practices.EnterpriseLibrary.Logging.Logger