相关疑难解决方法(0)

Entity Framework 6是否支持.NET 4.0?

我相信Entity Framework 6适用于.NET 4.5.我想将它用于Visual Studio 2010项目,因此.NET 4.5不可用.

它是否支持.NET 4.0,因此支持Visual Studio 2010?

.net-4.0 entity-framework-6

35
推荐指数
1
解决办法
4万
查看次数

在Visual Studio 2015中使用ADO.NET和MySQL

我想在MySQL中使用ADO.NET,所以我为Visual Studio安装了MySQL Connector和MySQL:

MySQL Installer窗口,包含MySQL Server 5.6.23,MySQL Workbench 6.2.4,MySQL Notifier 1.1.6,MySQL for Visual Studio 1.2.3,Connector/NET 6.9.5和MySQL Documentation 5.6.23,全部用于X86架构

(我使用Visual Studio 2015和Windows 10)当我创建一个新的ADO.NET时,我没有MySQL:

EDM Assistant窗口,带有连接选择窗口

我不知道如何让MySQL与Entity Framework一起工作......我遵循了一个教程,但它不起作用.

c# mysql ado.net entity-framework visual-studio-2015

16
推荐指数
2
解决办法
3万
查看次数

实体框架向导在MySQL上崩溃

我的问题与类似,但崩溃发生在以后.我必须在SQL Server和MySQL之间互操作EF数据库优先模型.更具体地说,我的应用程序根据连接字符串和配置设置(DB_TYPE=MYSQL等等)向SQL Server或MySQL发出了简单的SQL查询,使两个数据库具有相同的结构并保持在一起,以便对一个模式的每个修改都重新应用于其他.

现在,我使用SQL Server数据库优先模型为应用程序添加了EF支持.我现在必须让应用程序在MySQL上运行.为了验证旧的开发人员没有在两个DBMS之间留下不对称的东西,我试着Update model against database*这次我在localhost上选择了MySQL连接到我的开发数据库.

点击Next下面的屏幕后,它将崩溃并返回EDMX编辑器

数据模型向导

我需要继续这个项目,我已经坚持了一段时间.

这是我的Web.config片段:

<entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
      <parameters>
        <parameter value="v11.0" />
      </parameters>
    </defaultConnectionFactory>
    <providers>
      <provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6, Version=6.9.5.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
    </providers>
  </entityFramework>
  <system.data>
    <DbProviderFactories>
      <remove invariant="MySql.Data.MySqlClient" />
      <add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.9.5.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
    </DbProviderFactories>
  </system.data>
Run Code Online (Sandbox Code Playgroud)

我怎样才能解决我的问题?我为Visual Studio重新安装了MySQL工具,但没有帮助.

*我使用Visual Studio的本地化版本,因此我不知道所有命令的原始英语

mysql entity-framework visual-studio-2013

15
推荐指数
1
解决办法
6692
查看次数

如何从实体框架 4 升级到 EF6?

我想用 Entity Framework 6 创建一个 EntityDataModel 但每次我尝试时都会收到此错误:

您的项目引用了旧版本的实体框架。

在此处输入图片说明

我使用的是 Visual Studio 2013,我的项目是 Asp.net 4.5.1 Web 表单项目。这是我的 web.config 文件,为了解决问题,我删除了该文件的某些部分,但都是徒劳的。

<?xml version="1.0"?>
<!--
For more information on how to configure your ASP.NET application, please   visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<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>
<!--
For a description of web.config changes see http://go.microsoft.com/fwlink/?LinkId=235367.

The following attributes can be set on the <httpRuntime> tag.
  <system.Web>
    <httpRuntime targetFramework="4.5.1" /> …
Run Code Online (Sandbox Code Playgroud)

c# asp.net entity-framework

6
推荐指数
1
解决办法
4544
查看次数

VS 2017 中的 MySQL 和 MVC 实体框架不起作用

我正在尝试启动一个 MVC EF Visual Studio 2017 项目。我在本地实例上使用 MySQL 设置了所有数据连接,但是当我创建 ADO.net 数据模型时,出现如图所示的错误:

在此处输入图片说明

这里还有另一篇文章:Can't use a MySQL connection for entity framework 6 that Covered VS 2012 and 2013 but not 2017. 这是 MySQL 文档,说明哪些版本适用于 2017:https : //dev.mysql.com/ doc/visual-studio/en/visual-studio-install.html

我在用:

MySQL 连接器网络 6.9.9 | 用于 Visual Studio 1.2.7 的 MySQL | MySQL 服务器 5.7

MySQL.Data 6.9.9 | MySQL.Data.Entity 6.9.9 | 实体框架 6.1.3

所有这些都被列为经 MySQL 测试和工作的。我今天刚刚安装了所有新的东西,所以没有优秀的旧版本。我三重检查;)

连接字符串:

<connectionStrings> <add name="MySQL" connectionString="server=localhost;port=3306;user id=root;password=password;database=localdb" providerName="MySql.Data.MySqlClient" /> </connectionStrings>


编辑

我发现这篇文章https://dev.mysql.com/doc/connector-net/en/connector-net-entityframework60.html谈到了建立连接,但现在不是那个错误,而是对话框消失了一旦我点击“下一步”。


这只是我做错了什么还是 MySQL 连接器坏了? …

c# mysql asp.net-mvc entity-framework visual-studio

5
推荐指数
1
解决办法
8672
查看次数