EF4.1 Code First Error

EF4.1 Code First Error

Postby andyscott12 » Mon 25 Apr 2011 13:52

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

Code: Select all
     connectionString="Server=localhost; Database=project; Uid=root; Pwd=pass;"
     providerName="MySql.Data.MySqlClient"/>


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 ?
andyscott12
 
Posts: 6
Joined: Tue 01 Feb 2011 04:19

Postby AndreyR » Tue 26 Apr 2011 11:18

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.
AndreyR
Devart Team
 
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Postby testerguy » Wed 29 Feb 2012 06:03

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.
testerguy
 
Posts: 1
Joined: Wed 29 Feb 2012 05:57

Postby Shalex » Wed 29 Feb 2012 16:05

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.
Shalex
Devart Team
 
Posts: 7460
Joined: Thu 14 Aug 2008 12:44


Return to dotConnect for MySQL