mysql EF
使用 mysql-installer-community-5.6.26.0.msi
visual studio 2013 update 4版
Install-Package EntityFramework
Install-Package EntityFramework.zh-Hans
Install-Package MySql.Data.Entity //这个不需要 可能与你安装的版本不一样而不能用.
否则生成不了模板 可以直接在 mysql connect 中加引用需要的dll
目录中不能有中文,不然不能用.
把"DDL 生成模板"改成 mysql的方式.
元数据项处理不需要改.
app.config
<configuration>
<configSections>
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
</configSections>
//加这个不然mono 下不认.
<system.data>
<DbProviderFactories>
<remove invariant="MySql.Data.MySqlClient"></remove>
<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.0.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
</DbProviderFactories>
</system.data>
<entityFramework>
<defaultConnectionFactory type="MySql.Data.Entity.MySqlConnectionFactory, MySql.Data.Entity.EF6" />
<providers>
<provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6"></provider>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
</entityFramework>
<connectionStrings><add name="flynewmysqlEntities" connectionString="metadata=res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl;provider=MySql.Data.MySqlClient;provider connection string="server=localhost;user id=root;password=root;persistsecurityinfo=True;database=flynewmysql"" providerName="System.Data.EntityClient" /></connectionStrings>
</configuration>
如果要在 .net Framwork 4.5下运行,直接删除 system.data 段就可以了.
在 windows 下 mono 运行时 直接用 xbuild 编译生成 .exe 文件. 用 monodevlop 没有成功.
生成后需 把 EntityFramework 与 EntityFramework.zh-Hans 的 Dll拷到生成的目录,不知道这里怎么配置.
下一步再直接放到linux 上看行不.
看网上说有中文问题先记下来:
将默认编码 default-character-set=utf8 改为 default-character-set=gbk ,重新启动 MySQL 服务即可。
最新文章
- cacti web页面访问 settings出错
- 打包解决方案后,安装时提示只能在IIS5.1以上运行解决方法
- Trie树-可持久化
- window2012 64bit 安装sqlserver2012 64bit调用excel的驱动安装
- windows平台快速安装 matplotlib
- C# 与 VC Dll 传输信息
- linux 下的对拍
- VS2010启动奔溃
- css 问题总结
- javascript (九)注释
- java-redis集合数据操作示例(三)
- bzoj 4710: [Jsoi2011]分特产
- pytest学习 一
- 在宿主机查看docker使用cpu、内存、网络、io情况
- docker常用命令记录
- Reactor 3 学习笔记(1)
- 8.Python爬虫实战一之爬取糗事百科段子
- Nginx 服务器搭建
- Intellij IDEA使用spring-boot-devtools无效解决办法(2018年3月9日11:46:00)
- e864. 取的显示器大小尺寸
热门文章
- ZOJ 2563	Long Dominoes(状压DP)
- lintcode:在O(1)时间复杂度删除链表节点
- A. Counting Kangaroos is Fun(贪心)
- [hackerrank]The Love-Letter Mystery
- PostgreSql中如何kill掉正在执行的sql语句
- IOSTimer的例子留个备注
- c# webbrowser 清除当前网站 cookie
- LA 5846 (计数) Neon Sign
- UVa 11389 (贪心) The Bus Driver Problem
- jdom学习读取XML文件