Reputation: 41
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?
Upvotes: 1
Views: 1824
Reputation: 122040
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.
Upvotes: 2