ADO.NET Provider for AlloyDB

Build 23.0.8839

Using EF 6

The Entity Framework is now being developed outside of the .NET Framework. This means several dependencies that were part of the .NET framework are now part of the Entity Framework. This section describes how to use Entity Framework 6 (EF6) in your project.

Install Entity Framework 6

First, install and configure the EF6 environment. Use the Package Manager Console in Visual Studio to install the latest version of Entity Framework. Run the the following command to download and install Entity Framework automatically:

Install-Package EntityFramework

Register the Entity Framework Provider

Complete the following steps to register the Entity Framework provider:

  1. Add the following provider entry in the "providers" section of your App.config or Web.config. This section should already exist if the Entity Framework installation was successful.
    <configuration>
    ...
    <entityFramework>
      <providers>
        ...
        <provider invariantName="System.Data.CData.AlloyDB" type="System.Data.CData.AlloyDB.AlloyDBProviderServices, System.Data.CData.AlloyDB.Entities.EF6" />
      </providers>
    </entityFramework>
    </configuration>
  2. Add a reference to System.Data.CData.AlloyDB.Entities.EF6.dll, located in the lib subfolder in the installation directory.
  3. Build the project to complete the setup for using EF6.

Build the Project

It is important to build the project so that the referenced assemblies are copied locally to the build location. These assemblies are used by the Visual Studio Entity Data Model wizard.

Using Entity Framework

With the setup complete, you can either use the Entity Data Model wizard described in Model-First Approach or use the code-first approach described in Code-First Approach.

Copyright (c) 2024 CData Software, Inc. - All rights reserved.
Build 23.0.8839