MySQL has recently been used, and has previously been used with EF, so try to entityframework+mysql the solution.
First search the Internet after a chase information, so start:
Install MySQL, I use the version is 5.6.25 (Windows Installer version)
After installing the EF6, NuGet installs Mysql.data, mysql.data.entity these two items. The current version of Mysql.data.entity is 6.9.6
NuGet will automatically configure the config file, which should add the following lines
<provider invariantname="MySql.Data.MySqlClient " type= " MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6, version=6.9.6.0, Culture=neutral, publickeytoken=c5687fc88969c44d">
<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.6.0, Culture=neutral, PublicKeyToken =c5687fc88969c44d" /> </DbProviderFactories>
And then we need to add the connection string ourselves.
<connectionStrings> <add name="mycontext" connectionstring= " Data source=localhost;port=3306;initial catalog=test;user id=root;password=1111; " providername="MySql.Data.MySqlClient"/> </connectionstrings >
Once configured, you can write code.
[Dbconfigurationtype (typeof(MySql.Data.Entity.MySqlEFConfiguration))] Public class Mycontext:dbcontext { publicbase("name=mycontext") { publicgetset;} Here are the various model }}
Next is to start writing code according to business requirements, look forward to it, accurately, is looking forward to the next various pits, I have been prepared psychologically.
Entityframework+mysql Notes 1