Appendix A. Entity Framework Assemblies and Namespaces

This appendix will provide you with a high-level overview of the assemblies and namespaces of the Entity Framework. You will learn about the files that are used for the Entity Framework and the namespaces of the Entity Framework and their purpose.

Unpacking the Entity Framework Files

You’ll find the physical DLL files that contain the Entity Framework APIs in the following two directories:

  • <system drive>:Program FilesReference AssembliesMicrosoftFrameworkv3.5, which contains:

    • System.Data.Entity.Design.dll

      This file contains functionality related to the design tools, such as the Designer, the mapping details, and the model viewer.

    • System.Data.Entity.dll

      This file is the root of the Entity Framework. It contains all of the namespaces and classes for programming against the Entity Data Model (EDM).

  • <system drive>:WindowsMicrosoft.NETFrameworkv3.5, which contains:

    • Microsoft.Data.Entity.Build.Tasks.dll

      This file contains the functions for compilation tasks, including building the EDM schema files.

Exploring the Namespaces

The Entity Framework lives within the System.Data namespace of the .NET Framework. New functionality (classes, properties, and methods) has been added to existing namespaces in the System.Data hierarchy, along with a number of new namespaces that begin with the term System.Data.Entity. The System.Data.Entity.dll assembly provides all of the namespaces, as shown in Figure A-1.

Namespaces provided in System.Data.Entity.dll

Figure A-1. Namespaces provided in System.Data.Entity.dll

Existing Namespaces That Have New Classes and Functionality

A number of existing namespaces have new classes and functionality added to them to support the Entity Framework:

System.Data

System.Data is the namespace in the .NET Framework that provides all of .NET’s data access functionality. Some functionality is contained directly in System.Data, and much more exists in its subnamespaces.

The Entity Framework adds Exception classes directly to this namespace, as well as EntityKey, which provides a durable reference to an entity.

System.Data.Common

System.Data.Common provides base classes that are common to all of the data providers written for .NET. For example, DbDataReader is the base of SqlDataReader, OleDbDataReader, OracleDataReader, and more. The Entity Framework adds a few high-level DbProvider members into this namespace along with DataRecordInfo to expose query results in the form of a DbDataRecord and EntityRecordInfo, which provides access to the metadata of an entity.

System.Data.SqlClient

The provider information that allows the ADO.NET Entity Framework to communicate with Microsoft SQL Server is added into the System.Data.SqlClient class through additional classes added into the System.Data.Entity assembly.

System.Linq.Expressions

System.Linq.Expressions adds LINQ to Entities query functionality to the System.Linq.Expressions namespace.

New Namespaces

All of the functionality that you will use directly or indirectly when working in the Entity Framework lives in the following namespaces:

System.Data.Common.CommandTrees

System.Data.Common.CommandTrees adds logic for building Entity Framework command trees from LINQ to Entities and Entity SQL expressions. Each provider that is written to work with the Entity Framework will have the ability to turn these command trees into store queries.

System.Data.Entity

System.Data.Entity does not contain any classes or methods; it is the base for a hierarchy of other namespaces—namely, System.Data.Entity.Design and System.Data.Entity.Design.ASP.NET (discussed shortly).

System.Data.EntityClient

System.Data.EntityClient is a standard ADO.NET managed provider supporting access to the data described in the EDM. This namespace is comparable to System.Data.SqlClient or System.Data.OracleClient and provides classes such as EntityConnection, EntityCommand, and EntityDataReader.

System.Data.Mapping

System.Data.Mapping provides logic for performing view generation from query expressions.

System.Data.Metadata.Edm

System.Data.Metadata.Edm contains the types that are represented in the conceptual, mapping, and store schemas that define and support the EDM. Using these types directly, it is possible to programmatically work with the metadata of the model.

System.Data.Objects

System.Data.Objects is the most important namespace in the Entity Framework. It provides the classes for querying, change tracking, relationship management, and updating the data store through the EDM. The functionality provided by System.Data.Object and its child namespace, DataClasses, is referred to as “Object Services.”

System.Data.Objects.DataClasses

System.Data.Objects.DataClasses contains the classes and interfaces that allow types described in the EDM to be instantiated as objects. With these classes you can programmatically interact with the data that is provided as a result of querying the EDM.

System.Linq.Expressions

System.Linq.Expressions adds the necessary expressions for performing LINQ to Entities queries.

System.Data.Entity.Design

System.Data.Entity.Design provides functionality for generating an EDM as well as performing the code generation to create classes from the EDM.

System.Data.Entity.Design.ASP.NET

System.Data.Entity.Design.ASP.NET provides the build providers used in the build environment for ASP.NET.

System.Data.Query.InternalTrees

System.Data.Query.InternalTrees provides the tools for converting query expressions to be converted to command trees that are executed against the Entity Framework. This is very low-level and all of the members in this namespace are sealed.

System.Data.Query.PlanCompiler

System.Data.Query.PlanCompiler is another namespace filled with low-level functionality for processing queries.

System.Data.QueryResultAssembly

System.Data.QueryResultAssembly, the third subnamespace in System.Data.Query, is also low-level and sealed. When data is returned from the data store, it needs to be transformed into objects. This namespace contains the tools that are used internally to perform this transformation.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.172.38