使用mysql C#连接实体框架 [英] Connection entity framework with mysql C #

查看:190
本文介绍了使用mysql C#连接实体框架的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,

我已经配置了在Visual Studio 2012中使用Entity Framwork连接MySQL所需的全部内容



所有这一切都在进行中好吧,



我在我的代码中得到了我的表的映射,



这里是我的代码:



Hello,
I have configured all necessary to connect with MySQL with Entity Framwork in Visual Studio 2012

And all this is going well,

I get the mapping of my table in my code,

here is my code:

using (testuserEntities context = new testuserEntities())
           {
               personels nam = context.personels.FirstOrDefault(x => x.name == "Walid");
               if (nam !=null )
               {
                   textBox1.Text = nam.name;
               }
           }





执行中,我收到错误:



http:// i .stack.imgur.com / UrZWO.png [ ^ ]



我尝试过:



连接实体MySQL的框架C#



In the execution, I get the ERROR:

http://i.stack.imgur.com/UrZWO.png[^]

What I have tried:

Connection Entity Framework with MySQL C #

推荐答案

按照此处的说明:

MySQL :: MySQL Connector / Net Developer Guide :: 9 EF6 Support [ ^ ]

实体框架配置文件设置 [ ^ ]

实体框架连接管理 [ ^ ]

实体框架(EF)文档 [ ^ ]
Follow the instruction here:
MySQL :: MySQL Connector/Net Developer Guide :: 9 EF6 Support[^]
Entity Framework Config File Settings[^]
Entity Framework Connection Management[^]
Entity Framework (EF) Documentation[^]


我找到了解决方案:我们必须更新DLL:



1)右键单击解决方案(解决方案资源管理器中的顶级)



2)管理Nuget包以获得解决方案



3)去更新(位于左侧)



4)更新软件包:MySql.Data,MySql.Data.Entities,Entity.Framwork



我们在App中有变化。配置文件:



I find the solution: We must update the DLL:

1) Right click on the Solution (top level in the solution explorer)

2) Manage Nuget packages for solution

3) Go to update ( locate in the left)

4) Update the packages :MySql.Data, MySql.Data.Entities, Entity.Framwork

we have change in the App.config file:








它对我有用!!




It works for me !!


这篇关于使用mysql C#连接实体框架的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆