mysql edmx_Mysql –>EF edmx(model first)–> Sql server table

一、mysql environment

When we create an new database,first We need draw er diagram for somebody to show your idea,but our company have no good

authorised tool to design sqlserver ER diagram,so I use mysql graphical tool to design it, after that,you can use mysql to create edmx

us entityframwork,and use this edmx to create new sqlserver database or table.The following is details:

1、first you need install mysql,the download address is http://dev.mysql.com/downloads/windows/installer/,this version is no need to install,

ba2dbc9052afbc7fbb208a2bf8c85046.png

after that,you need install mysql,the install detail and config,you can see the article.

for operating mysql database conviniently,you can download grapahics tool workbencn

after you create new datatable use mysql.

二、EntityFrameWork 6.0.0.0 connect Mysql to create EF

note:(1)you need install MySQL for Visual Studio and Connector/Net correctly,otherwise you will happen some terrible,

for example;you will not find  mysql Databse option。

1b0741393e9bd085124cab42c2461be9.png

(2)if you have isntall ef,but don‘t find  ADO.Net entity Data Model,maybe you have make something wrong,you

can uninstall Entity framework at control panel and reinstall it.

8290615cd033fc68fd53a5de9f33d66e.png

e165a1b4106d433c1c6f30cfd2b394b2.png

三、EF edmx create sqlserver database。

1、you can use Generate Database from Model to create sqlserver table

bcff103b91f55eae1cece66bf866fbee.png

2、change connection Type to Sql server  and connect to database you want to create table

3c51668b2007a1e264a5a6bdc14f0c6d.png

2、Next you will meet the following error

cc0163c38b9c258dd8cf705e9d2c666b.png

you need change edmx file xml,click right mouse on edmx file,and you will find the following and

edit。

408aa648240d8534400b63f264ae0026.png

use

after that,you build project,you will find the following error,you need delete Precision and rebuild again.

If you want define table column type,you can define at this palce,and it will affect database table type。

07e58f00e79de2c298920b295ad12486.png

After that,you can use Generate Database from Model ,you can see the following window means

it is success,you can copy script to sqlserver studio to execute it or not。

e2f915e9266d0506331a7d2bae10a217.png

原文:http://www.cnblogs.com/cby-love/p/5594907.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值