【问题标题】:Visual Studio 2015 Only Shows SQL Server Connections When Trying to Create an ADO.NET Entity Model ClassVisual Studio 2015 仅在尝试创建 ADO.NET 实体模型类时显示 SQL Server 连接
【发布时间】:2018-07-13 15:54:04
【问题描述】:

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

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

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

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

Id 版本项目名称
-- -------- ------------
EntityFramework {6.2.0} bkInventory2App
Google.Protobuf {3.5.1} bkInventory2App
MySql.Data {8.0.11} bkInventory2App
MySql.Data.EntityFramework {8.0.11} bkInventory2App

App.config

<?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 中的数据库

【问题讨论】:

    标签: mysql visual-studio entity-framework-6


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-12-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-05-08
      • 1970-01-01
      • 2020-02-24
      相关资源
      最近更新 更多