转 ef中使用mysql步骤--Entity Framework 6 with MySql
原文:http://lvasquez.github.io/2014/11/18/EntityFramework-MySql/
For the Entity Framework 6 support we need to have this requirements
- MySQL Connector/Net 6.8.x
- MySQL Server 5.1 or above
- Entity Framework 6 assemblies
- .NET Framework 4.0 or above
I will use the concept of DataBase First but without using the Visual Studio wizard to create the Edmx file, so instead of that, I will do it manually. I will create a Console Application, so first install the Entity Framework via Nuget Package
Install-Package EntityFramework
Install-Package MySql.Data.Entity.EF6Add the connection string in the app.confing
the app.confing should be like this
<?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>
<connectionStrings>
<add name="MonkeyFist" connectionString="server=localhost;user id=root;password=mypass;database=mydb" providerName="MySql.Data.MySqlClient" />
</connectionStrings>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, 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>
<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.8.3.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"/>
</DbProviderFactories>
</system.data>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="EntityFramework" publicKeyToken="b77a5c561934e089" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
转 ef中使用mysql步骤--Entity Framework 6 with MySql的更多相关文章
- Entity Framework 6 with MySql
MySQL Connector/Net 6.8.x MySQL Server 5.1 or above Entity Framework 6 assemblies .NET Framework ...
- 全球首发免费的MySql for Entity Framework Core
from:http://www.1234.sh/post/pomelo-data-mysql?utm_source=tuicool&utm_medium=referral Source 源代码 ...
- Entity Framework Core For MySql查询中使用DateTime.Now的问题
背景 最近一直忙于手上澳洲线上项目的整体迁移和升级的准备工作,导致博客和公众号停更.本周终于艰难的完成了任务,借此机会,总结一下项目中遇到的一些问题. EF Core一直是我们团队中中小型项目常用的O ...
- ABP .Net Core Entity Framework迁移使用MySql数据库
一.迁移说明 ABP模板项目Entity Framework Core默认使用的是Sql Server,也很容易将数据库迁移到MySQL,步骤如下. 二.迁移MySQL步骤 1. 下载项目 请到 ht ...
- ASP.NET Core 中的 ORM 之 Entity Framework
目录 EF Core 简介 使用 EF Core(Code First) EF Core 中的一些常用知识点 实体建模 实体关系 种子数据 并发管理 执行 SQL 语句和存储过程 延迟加载和预先加载 ...
- Entity Framework 6+ 连接Mysql
好吧.这个博客开不开的 我感觉.. 都一样了. 前言: 公司改造Sqlserver ->Mysql Sql2016老夫对不住你啊.. 好 前沿结束. 需要的家伙: 1.mysql-for-vis ...
- Entity Framework Core 实现MySQL 的TimeStamp/RowVersion 并发控制
将通用的序列号生成器库 从SQL Server迁移到Mysql 遇到的一个问题,就是TimeStamp/RowVersion并发控制类型在非Microsoft SQL Server数据库中的实现.SQ ...
- 采用MiniProfiler监控EF与.NET MVC项目(Entity Framework 延伸系列1)
前言 Entity Framework 延伸系列目录 今天来说说EF与MVC项目的性能检测和监控 首先,先介绍一下今天我们使用的工具吧. MiniProfiler~ 这个东西的介绍如下: MVC Mi ...
- EF框架组件详述【Entity Framework Architecture】(EF基础系列篇3)
我们来看看EF的框架设计吧: The following figure shows the overall architecture of the Entity Framework. Let us n ...
随机推荐
- [转]Ubuntu /home下中文目录如何修改成英文?
http://www.linuxidc.com/Linux/2016-05/130873.htm 打开终端,在终端中输入命令: export LANG=en_US xdg-user-dirs-gtk- ...
- c_数据结构_栈的实现
#include<stdio.h> #include<stdlib.h> #define STACK_INIT_SIZE 100 #define STACKINCREMENT ...
- BZOJ4319 cerc2008 Suffix reconstruction 字符串 SA
原文链接http://www.cnblogs.com/zhouzhendong/p/9016336.html 题目传送门 - BZOJ4319 题意 给出一个$1,2,\cdots,n$的排列,第$i ...
- java获取iPhone手机图片旋转角度处理
参考原博客地址:https://www.cnblogs.com/zhao1949/p/6473882.html 这里需要的jar文件: https://files.cnblogs.com/files/ ...
- thinkphp5 Request请求类
获取请求类的几种方式: 1.助手函数(严格不算ba ) input('post.name'): 2.$request=\think\Request::instance(); 3.控制器中必须继承Con ...
- oracle连接连表查询时,两表的连接字段类型不一致的时候,会导致ora 01722无效数字错误,这时候需要转换
类型不匹配,需要类型转换,函数:to_char()转换成字符,to_num()转换成数字
- 使用EndNote在Word中插入参考文献
以百度文库为例,首先找到我们要插入的参考文献,比如 搜索关键词,然后下需要的论文下面点击引用 得到 点击下面导出链接的EndNote,会下载一个.enw文件 找到此文件并双击打开后即已经导入到EndN ...
- Stm32串口通信(USART)
Stm32串口通信(UART) 串口通信的分类 串口通信三种传递方式 串口通信的通信方式 串行通信的方式: 异步通信:它用一个起始位表示字符的开始,用停止位表示字符的结束.其每帧的格式如下: 在一帧格 ...
- DNS信息收集工具dig使用
Dig是域信息搜索器的简称(Domain Information Groper),使用dig命令可以执行查询域名相关的任务 常见域名记录: A(主机记录 把一个域名解析成IP地址) C name(别名 ...
- 001.NoSQL及MongoDB简介
一 NoSQL简介 二 分布式系统 三 CAP及BASE定律 以上均可参考: http://www.runoob.com/mongodb/nosql.html 四 MongoDB简介 参考:http: ...