1

I have this configuration:

<connectionStrings>
<!--<add name="NREticaretContext"
     connectionString="Data Source=localhost;Initial Catalog=myDBSqlServer;Persist Security Info=True;User ID=sa;Password=mypass;Timeout=20;"
     providerName="System.Data.SqlClient" />-->
<add name="NREticaretContext"
     connectionString="Server=localhost;Database=myDBMySQL;Uid=root;Pwd=mypass;port=3306;" providerName="MySql.Data.MySqlClient"/>

if I use first config setting(SQL Server) everythicg works fine in my project. But when I try to use second connection(mySQL) for mySQL connector which uses mySQL Entity Framework, application keeps on saying:

"Model compatibility cannot be checked because the EdmMetadata type was not included in the model. Ensure that IncludeMetadataConvention has been added to the DbModelBuilder conventions."

I have tried using :

protected override void OnModelCreating(DbModelBuilder modelBuilder)
    {
        modelBuilder.Conventions.Remove<IncludeMetadataConvention>();            
    }

in my Context class but it keeps on giving the same error... Your suggestions?

1 Answer 1

2

It seems that Connector /NET experiences some problems with EF 4.1 at the moment.
Try turning off the Initialization Strategy System.Data.Entity.Database.SetInitializer<MyContext>(null);
I recommend you to take a look at the Code First Support article at our blog. It describes some peculiarities of working with Code First in dotConnect for MySQL.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.