7.1 Entity Framework

The MySQL Application Configuration tool downloads the latest entity framework and MySQL Connector/NET assemblies from the NuGet gallery to keep the assembly versions synchronized. After the configuration is applied, the tool adds the following references to your project:

  • EntityFramework

  • EntityFramework.SqlServer

  • MySql.Data

  • MySql.Data.EntityFramework

Unlike the other web providers supported by this tool, the entity framework options can be applied to either non-web or web applications. The context of your project determines which configuration file the tool updates. The next sections describe the details for setting options with non-web and web projects.

Note

MySQL for Visual Studio does not support Entity Framework Core. For the current support profile, see Minimum Requirements.

Setting Options for Non-Web Applications

The MySQL Application Configuration tool synchronizes the latest version of MySQL Connector/NET and Entity Framework 6 assemblies and then adds the required references to your application's App.config file. When started in the context of a non-web application, the tool lists entity framework as the only item and MySQL for Visual Studio 1.2.9 (or higher) is a prerequisite. For an example of when you might use the tool, see Tutorial: Using an Entity Framework Entity as a Windows Forms Data Source.

To enable the tool, select Use MySQL with Entity Framework, ensure that Entity Framework 6.x is selected, and then click Finish (see the figure that follows).

Figure 7.2 MySQL Application Configuration Tool for Entity Framework (non-web)

Content is described in the surrounding text.

Setting Options for Web Applications

In the context of a web application, entity framework is the first page of options that you can enable. After enabling (or skipping) the entity framework option, the wizard-like tool steps through several additional web provider pages (see Section 7.2, “Web Providers”). You can enable entity framework alone and skip the other web providers, or selectively enable other providers in the same session.

With MySQL for Visual Studio 1.2.9 (or higher) installed, Entity Framework 6 is the only version to select, as the following figure shows. Previous versions of MySQL for Visual Studio permit you to configure your application to use Entity Framework 5 or 6. (Prior to version 1.2.9, this tool was named MySQL Website Configuration.) The current version of MySQL Connector/NET no longer supports Entity Framework 5.

To include entity framework options, select Use MySQL with Entity Framework, ensure that an Entity Framework version is selected, and then click Next to advance to the membership provider options. To skip configuring entity framework options, deselect the Use MySQL with Entity Framework check box.

Figure 7.3 MySQL Application Configuration Tool for Entity Framework (web)

Content is described in the surrounding text.

For information about the options on the membership (or simple membership), roles, profiles, session state, site map, and web personalization pages, see Section 7.2, “Web Providers”.