Materials:
1. MySQL for Visual Studio 1.2.4.msi
Download: http://dev.mysql.com/downloads/windows/visualstudio/
2, Mysql-connector-net-6.8.3.msi
Download: http://dev.mysql.com/downloads/file.php?id=405442
EntityFramework.dll, MySql.Data.dll, MySql.Data.Entity.EF6.dll
Can be obtained through the Nugget
3, VS2013 (FrameWork4.5)
Steps:
1, create a vs2013 project, import EntityFramework.dll, MySql.Data.dll, MySql.Data.Entity.EF6.dll
2, tools, extensions and updates, network search to "Entity FrameWork Power Tools Beta4", add this extension to vs 2013, new launch vs.
3. Use code first to generate the EF code used in the project.
4. Install MySQL for Visual Studio 1.2.4.msi VS access MySQL driver. The data source options for "figure three" appear.
5. Installing the Mysql-connector-net-6.8.3.msi Connector
Click on the figure three OK button to appear:
6, Note: If the error, please check whether the introduction of the EF dll; Whether the database field has special characters
7. Modify after the build is complete Config file.
Red Box One code:
1234 |
<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
>
|
Red Box Two code:
12345678910111213141516 |
<entityFramework>
<defaultConnectionFactory
type
=
"System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework"
>
<parameters>
<parameter value=
"v11.0"
/>
<
/parameters
>
<
/defaultConnectionFactory
>
<providers>
<provider invariantName=
"MySql.Data.MySqlClient"
type
=
"MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6, Version=6.9.7.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"
><
/provider
>
<
/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.9.7.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"
/>
<
/DbProviderFactories
>
<
/system
.data>
|
8 , configuration completed, write code test.
To configure the EF link MySql method