Entity Framework Support
The latest ADO.NET evolution focuses on raising the level of abstraction from the logical
(relational) level to the conceptual (entity) level. For this purpose Microsoft introduces
the Entity
Framework, designed to simplify data - object conversion and embed data access queries
into program code.
The Devart dotConnect product line supports the ADO.NET Entity Framework for Oracle, MySQL, PostgreSQL, and SQLite.
The article consists of the following sections:
What is ADO.NET Entity Framework?
The Entity Framework is a set of technologies in ADO.NET that support
development of data-oriented software applications.
The Entity Framework is designed to enable developers to create data
access applications by programming against a conceptual application
model instead of programming directly against a relational storage
schema. The goal is to decrease the amount of code and maintenance
required for data-oriented applications. Entity Framework applications
provide the following benefits:
- Applications can work in terms of a more application-centric conceptual
model, including types with inheritance, complex members, and relationships.
- Applications are freed from hard-coded dependencies on a particular data
engine or storage schema.
- Mappings between the conceptual model and the storage-specific schema can
change without changing the application code.
- Developers can work with a consistent application object model that can
be mapped to various storage schemas, possibly implemented in different
database management systems.
- Multiple conceptual models can be mapped to a single storage schema.
- Language-integrated query support provides compile-time syntax validation
for queries against a conceptual model.
Entity Framework Support Key Features
- Conceptual approach to enterprise development
- High performance
- Wide support for LINQ to Entities capabilities
- Wide support for EntitySQL
- Full CRUD (Create, Retrieve, Update, Delete) support
- Wide support for server data types
- Change tracking support
- Object data caching
- Inheritance mapping support (TPH, TPT, and TPCT models)
- Capability to use stored procedures when manipulating data
- Stored procedure import support
- Ability to build database-independent applications
- Visual Studio EDM Wizard support
- Reverse engineering of database objects to entity model
Using the Entity Data Provider
Use of dotConnect for Oracle in the Entity Framework is similar to use of standard
SqlClient. Generally it conforms to the following scheme:
- Open your project.
- Add new item ADO.NET Entity Data Model to your project and specify its name.
- Choose Generate from database.
- Choose the dotConnect you use as data provider and specify the connection string.
- Select tables that are actually used in your project and click Generate
to finish the process. If the selected tables contain foreign keys,
they will be reflected in the generated models as well.
- Specify a name for the model namespace. Note that this name should be
different from the database (schema) name.
For your convenience there is a brief Entity
Framework Tutorial that you can use to get acquainted with the
technology.
You can also take a look at Entity Framework samples available
with the product, or download separate Entity
Framework Query Samples package. The latter is a standard Microsoft
demo with added Oracle/MySQL/PostgreSQL/SQLite connectivity.
Deploying an Entity Framework Project
There are two requirements for Entity Framework projects to function. First,
the required assembly Devart.Data.xxx.Entity.dll must be available for your
application. The assembly should reside in GAC or in the application's folder,
and it is named according to the dotConnect you use:
Devart.Data.Oracle.Entity.dll,
Devart.Data.MySql.Entity.dll,
Devart.Data.PostgreSql.Entity.dll, or
Devart.Data.SQLite.Entity.dll.
Second, your environment must be informed about the existence of the provider
factory. The provider factory is described either in machine.config
(globally) or in app.config (just for your application), but not in both files. Assuming that
you use dotConnect for Oracle, this is done as follows:
<system.data>
<DbProviderFactories>
<remove invariant="Devart.Data.Oracle" />
<add name="dotConnect for Oracle" invariant="Devart.Data.Oracle"
description="Devart dotConnect for Oracle"
type="Devart.Data.Oracle.OracleProviderFactory, Devart.Data.Oracle,
Version=5.25.44.0, Culture=neutral, PublicKeyToken=09af7300eec23701" />
</DbProviderFactories>
</system.data>
You can also read Micrsoft's Deployment Considerations
on ADO.NET Entity Framework.
Visual Model Creation
dotConnects for MySQL, Oracle, and PostgreSQL are tightly integrated with Visual Studio Entity Data Model Wizard
for generating model definitions.
dotConnects also include several demo projects that show how to use the product in conceptual programming against data.
Compatibility and Requirements
dotConnects for Oracle, MySQL, PostgreSQL, and SQLite are compatible
with the latest version of ADO.NET Entity Framework and Visual Studio.
The following server versionis are required for Entity Framework to function properly:
- Oracle: 9.2.0.4 or higher
- MySQL: 5.0 or higher
- PostgreSQL: 8.0 or higher
- SQLite: any supported version