B
B
bullycoder2015-04-29 13:37:42
MySQL
bullycoder, 2015-04-29 13:37:42

How to connect to a remote MySQL database using EF6?

What you need to register in the config, what to connect to the database.

<connectionStrings>
    <add name="DataContext"
         connectionString="metadata=res://*/Data.Entity.Model.csdl|res://*/Data.Entity.Model.ssdl|res://*/Data.Entity.Model.msl;provider=MySql.Data.MySqlClient;provider connection string=&quot;Data Source=mysql46.1gb.ru;User Id=login;Password=pass  ;Initial Catalog=databasename;&quot;"
         providerName="System.Data.EntityClient"/>
  </connectionStrings>
  <entityFramework codeConfigurationType="MySql.Data.Entity.MySqlEFConfiguration, MySql.Data.Entity.EF6">
    <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>

This is not how it works, when I try to get data I get Unable to load the specified metadata resource.
Tell me please.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question