MySQL with Entity Framework Code First

0

I have a project where I need to use MySQL as a database and EF6 with the CODE FIRST approach.

I installed MySql.Data.Entity 6.9.9 and EntityFramework 6.1.3

My app.config looks like this:

<configSections>
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
</configSections>
<connectionStrings>
<add name="MyContext" providerName="MySql.Data.MySqlClient"
    connectionString="server=localhost;port=3306;database=MyContext;uid=user;password=***"/>
</connectionStrings>
<entityFramework>
<defaultConnectionFactory type="MySql.Data.Entity.MySqlConnectionFactory, MySql.Data.Entity.EF6" />
<providers>
<provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6" />
</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.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
</DbProviderFactories>
</system.data>

When I run update-database I get the following message:

  

Target database is: 'MyContext' (DataSource:. \ SQLEXPRESS, Provider: System.Data.SqlClient, Origin: Convention).

VS2015 is creating the database in SQLEXPRESS, what do I need to change to use MySQL?

    
asked by anonymous 28.10.2016 / 12:28

0 answers