Mysql–>ef EDMX (model first) –> SQL Server table

Source: Internet
Author: User
Tags mysql for visual studio

    • First,MySQL environment

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

Authorised tool to design SQL Server 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 SQL Server database or table. The following is details:

1. First you need install mysql,the download address was Http://dev.mysql.com/downloads/windows/installer/,this version is No need to install,

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

http://laizetian.blog.51cto.com/10728827/1786180,

For operating MySQL database conviniently,you can download Grapahics tool WORKBENCN

https://dev.mysql.com/downloads/workbench/.

After you create the new DataTable use MySQL.

Second, entityframework 6.0.0.0 connect Mysql to create EF

Can folling the article to install http://www.cnblogs.com/dunitian/p/4755585.html

Note: (1) You need install MySQL for Visual Studio and connector/net correctly,otherwise you'll happen s ome Terrible,

For example;you would not find MySQL databse option.

(2) If you have isntall ef,but don ' t find ADO entity Data Model,maybe you had make something wrong,you

Can uninstall Entity framework at Control Panel and reinstall it.

Third,EF edmx Create SQL Server database.

1. You can use the Generate Database from the Model to create SQL Server table

2. Change connection Type-to-SQL Server and connect to database want to create table

2. Next you'll meet the following error

You need change edmx file Xml,click right mouse in edmx File,and you'll find the following and

Edit

Use

<schema namespace= "Rightsdatamodel.store" provider= "System.Data.SqlClient" providermanifesttoken= "alias=" Self "xmlns:store=" Http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator "xmlns: customannotation= "http://schemas.microsoft.com/ado/2013/11/edm/customannotation" xmlns= "http// SCHEMAS.MICROSOFT.COM/ADO/2009/11/EDM/SSDL ">

Replace <schema namespace= "Mydbmodel.store" provider= "MySql.Data.MySqlClient" providermanifesttoken= "5.7" alias= "Self" xmlns:store= "Http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" xmlns: customannotation= "http://schemas.microsoft.com/ado/2013/11/edm/customannotation" xmlns= "http// SCHEMAS.MICROSOFT.COM/ADO/2009/11/EDM/SSDL ">

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

If you want define table column Type,you can define on this palce,and it would affect database table type.

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

It is success,you can copy script to SQL Server studio to execute it or not.

Mysql–>ef EDMX (model first) –> SQL Server table

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.