首页 > 解决方案 > Visual Studio 2015 仅在尝试创建 ADO.NET 实体模型类时显示 SQL Server 连接

问题描述

我之前已经创建了一个 MySQL 数据库实例,如Code Review 上的这个问题中所述。我已经完成了数据库,并准备在 Visual Studio 2015 中使用 C# 创建应用程序。

我在 stackvoverflow.com 上找到的唯一一个似乎相关的问题就是这个问题

我一直在使用这些页面中的 MySQL 文档:

环境是 Windows 10,regedit 图像显示 .net 框架版本。本周早些时候,我将 MySQL 升级到了 8.0.11 版本。包管理器控制台:PM> get-package

Id 版本 ProjectName
-- -------- ------------
EntityFramework {6.2.0} bkInventory2App
Google.Protobuf {3.5.1} bkInventory2App
MySql.Data {8.0.11} bkInventory2App
MySql .Data.EntityFramework {8.0.11} bkInventory2App

应用程序配置

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
  </configSections>
  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
  </startup>
  <connectionStrings>
    <add name="MySQLBKLibInventory" providerName="MySql.Data.MySqlClient" connectionString="SERVER=localhost;DATABASE=pacswlibinvtool;UID=root;PASSWORD=******;" />
  </connectionStrings>
  <entityFramework>
    <defaultConnectionFactory type="MySql.Data.Entity.MySqlConnectionFactory, EntityFramework"/>
    <providers>
      <provider invariantName="MySql.Data.MySqlClient"
          type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6"/>
      <!-- provider invariantName="System.Data.SqlClient"
          type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" -->
    </providers>
  </entityFramework>
</configuration>

点网版
在此处输入图像描述

添加 ADO.NET 类
在此处输入图像描述

选择模型内容 在此处输入图像描述

选择数据连接
在此处输入图像描述

选择数据源
在此处输入图像描述

ODBC 数据管理员
在此处输入图像描述

已安装的 MySQL 应用程序
在此处输入图像描述

MySQL WorkBench 中的数据库
在此处输入图像描述

标签: mysqlvisual-studioentity-framework-6

解决方案


请注意,倒数第二张图片显示已安装的 MySQL 应用程序,未安装 MySQL for Visual Studio。安装 MySQL Visual Studio 纠正了这个特定的配置问题。


推荐阅读