1

I am following this guide: http://www.asp.net/entity-framework/tutorials/creating-an-entity-framework-data-model-for-an-asp-net-mvc-application

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

So far I have downloaded the MySqlConnector/Net (and also Devart dotConnect). In my web.config I have added the following under

<add name="ProjectContext"
     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.

<DbProviderFactories>
  <clear/>
  <add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.3.6.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
</DbProviderFactories>

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?

2 Answers 2

1

We have already replied to you at our forum here.
Feel free to contact us if you encounter any other problems with our components.

2
  • It appears that you also copied the question into your forums. But thanks. Now it works with dotConnect. Although at $199.5 for a license, it's probably cheaper to go for MSSQL hosting.
    – kasperhj
    Apr 26, 2011 at 19:05
  • I thought it was your post. Sorry for that, I should have posted the complete answer here.
    – Devart
    Apr 27, 2011 at 8:35
0

MySql Connector/NET did not support Entity Framework Code First until version 6.6.

For a tutorial on MVC with Connector/NET see https://blogs.oracle.com/MySqlOnWindows/entry/building_an_mvc_3_application

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.