Go to EF using my step--entity Framework 6 with MYSQL

Source: Internet
Author: User
Tags connectionstrings

Original: http://lvasquez.github.io/2014/11/18/EntityFramework-MySql/

For the Entity Framework 6 support We need to has this requirements

    • MySQL connector/net 6.8.x
    • MySQL Server 5.1 or above
    • Entity Framework 6 Assemblies
    • . NET Framework 4.0 or above

I'll use the concept of DataBase first but without using the Visual Studio Wizard to create the Edmx file, so instead of That, I'll do it manually. I'll create a Console application, so first install the Entity Framework via Nuget Package

Install-Package EntityFramework
Install-Package MySql.Data.Entity.EF6

Add the connection string in the App.confing
The app.confing should is like this
<?xml version="1.0"encoding="Utf-8"?><configuration> <configSections> <!--for more information on Entity Framework configuration, Visi T 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> <connectionStrings> <add name="monkeyfist"connectionstring="Server=localhost;user Id=root;password=mypass;database=mydb"Providername="MySql.Data.MySqlClient"/> </connectionStrings> <startup> <supportedruntime version="v4.0"sku=". netframework,version=v4.5"/> </startup> <entityFramework> <defaultconnectionfactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework"/> <providers> <provider invariantname="MySql.Data.MySqlClient"Type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6"/> <provider invariantname="System.Data.SqlClient"Type="System.Data.Entity.SqlServer.SqlProviderServices, Entityframework.sqlserver"/> </providers> </entityFramework><system.data> <DbProviderFactories> <remove in Variant="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.8.3.0, Culture=neutral, publickeytoken= C5687FC88969C44D"/> </DbProviderFactories> </system.data> <runtime> <assemblybinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyidentity name="EntityFramework"publickeytoken="b77a5c561934e089"Culture="Neutral"/> <bindingredirect oldversion="0.0.0.0-6.0.0.0"newversion="6.0.0.0"/> </dependentAssembly> </assemblyBinding> </runtime></configuration>

Go to EF using my step--entity Framework 6 with MYSQL

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.