VistaDB 5
Gibraltar VistaDB / Getting Started / Using VistaDB with Entity Framework / Using VistaDB with Entity Framework - Upgrading To Entity Framework 6
In This Topic
    Using VistaDB with Entity Framework - Upgrading To Entity Framework 6
    In This Topic

    When upgrading from Entity Framework 4.0 or 5.0 to a later version you need to also switch the VistaDB Entity Framework Provider to the correct version.  Visual Studio relies on having the correct provider information in the app.config file for the assembly where the Entity Model (.edmx) file is as well as the provider assembly or it will not start the visual designer or let you do model updates.  Therefore the sequence is important:

     Step One: Add The VistaDB Entity Framework Provider for Version 6

    Add a reference to the Entity Framework 6 provider assembly (VistaDB.5.Entity.6.NET40.dll).  For more information on the various VistaDB assemblies and their roles see Deploying VistaDB with your Application.

    You can add the provider from NuGet to simplify this process - just search for VistaDB and select the VistaDB 5 Provider for Entity Framework 6 and later
     Step Two: Upgrade Entity Framework

    Using the NuGet Package manager, upgrade to Entity Framework 6 (or the latest version).  Do not perform extra steps for migrating to EF 6 such as changing the code generation model yet.

    After you have updated Entity Framework follow Microsoft's instructions for upgrading your application project, stopping before upgrading the project's code generation templates.

     Step Three: Update the App.Config For Version 6

    An additional entry is required to register the VistaDB Entity Framework Provider for EF 6 to find it.  Add the following section to the configuration file:

    App.Config or Web.Config File
    Copy Code
    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
      <entityFramework>
        <providers>
          <provider invariantName="System.Data.VistaDB5" type="VistaDB.Entity.VistaDBProviderServices, VistaDB.5.Entity.6.NET40" />
        </providers>
      </entityFramework>
    </configuration>
    

    When Entity Framework 6 was added it will have added additional entries.  For a more complete picture on what the final configuration file needs to include see Using VistaDB with Entity Framework - Registering the Provider.

    If you add the VistaDB Provider from NuGet this will automatically be taken care of for you.
     Step Four: Build the Assembly

    Before you can complete the EF 6 upgrade process and use the designer you need to build the assembly.  This ensures that the updated app.config file, Entity Framework assemblies, and VistaDB provider assembly are all located in your output binary directory.  Visual Studio checks here for these specific items to enable the Entity Framework tooling to use third party providers.

    If you find yourself in a situation where you can't compile the application and need to get the Entity Framework tooling to function you can update your output directory manually, updating the config file, EntityFramework.dll, and VistaDB Entity Framework provider assembly.
     Step Five: Complete Entity Framework 6 Migration
    You should now be able to use the visual designer for the EDMX file in your project.  To complete the upgrade following Microsoft's instructions on upgrading your project's code generation templates.
    See Also