Page 1 of 1

EF4.1 Code First Error

Posted: Mon 25 Apr 2011 13:52
by andyscott12
Hi There,

I am following this guide: http://www.asp.net/entity-framework/tut ... pplication

So that is MVC3 with EF Code First and I am trying to use MySQL instead of SQLSERVER.

So far I have downloaded the Devart dotConnect and also tried the MySQL Connector. In my web.config I have added the following under
Next, I found out that the following also has to be added to the web.config. I don't know why though.

Code: Select all

  
  
I have a simple POCO model for a post called Post. I am under the impression that when this compiles, and the lazy loading kicks in, the entity framework should create a table for me that's called 'post' (or 'posts').

However, when this runs, I get the following error: "Table 'project.posts' doesn't exist" indicating that the EF does NOT create this for me.

When I use the dotConnect instead, I get the another error: "Unknown database 'dbo'".

Does anyone have some insight as to what's going on? I did find this post [ http://social.msdn.microsoft.com/Forums ... 5d522aac4b ] but not sure whether it provides much insight ?

Why doesn't DevArt work ?

Posted: Tue 26 Apr 2011 11:18
by AndreyR
Take a look at our Code First support article.
The problem with "dbo" default schema can be easily solved using the following workaround:

Code: Select all

MySqlEntityProviderConfig config = MySqlEntityProviderConfig.Instance; 
config.Workarounds.IgnoreSchemaName = true;
Please note that the MySqlEntityProviderConfig class is available since dotConnect for MySQL 6.30.145 Beta only.
It is available in the Devart.Data.MySql.Entity assembly.

Posted: Wed 29 Feb 2012 06:03
by testerguy
This workaround is broken on the latest version of the MySQL dotConnect. I upgraded to 6.70.311.0.

Previously, using 6.50, I had this error, and I corrected it using the following code:

Dim config As MySqlEntityProviderConfig = MySqlEntityProviderConfig.Instance
config.Workarounds.IgnoreSchemaName = True

This fix worked and the error disappeared.

However, now I upgraded to 6.70.311.0 the error has returned.

Please advise, thanks.

Posted: Wed 29 Feb 2012 16:05
by Shalex
We cannot reproduce the problem with IgnoreSchemaName using dotConnect for MySQL v 6.70.311:
1. Specify the version (x.x) of Entity Framework you are working with.
2. Send us a small test project to reproduce the issue in our environment.