Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6684255
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T04:55:09+00:00 2026-05-26T04:55:09+00:00

EF 4.1 together with MySQL and Connector/Net 6.3.6 doesn’t create tables auto-magically based on

  • 0

EF 4.1 together with MySQL and Connector/Net 6.3.6 doesn’t create tables auto-magically based on my POCO objects. I’m not sure if I have the configuration wrong or if Connector/.Net 6.3.6 simply doesn’t support this functionality. I have crawled the Internet for a week now without finding an answer and I believe I have gone through all the EF and MySQL questions here at stackoverflow. I’ve noticed many posts refer to dotConnect (e.g. Problems using EF4.1 Code First with MVC3 and MySQL), but I need to find a free solution. I have set up forms authentication, and this works fine with MySQL providers, but I had to create the database schema and tables manually.

I have set up my project in the following way. Parts of my web.config file.

<connectionStrings>
    <add name="MySQLConn" connectionString="Server=localhost;Database=XxX;Uid=xXx;Pwd=xXx;" providerName="MySql.Data.MySqlClient" />
</connectionStrings>

    <profile defaultProvider="MySqlProfileProvider" enabled="true">
        <providers>
            <clear />
            <add name="MySqlProfileProvider" type="MySql.Web.Profile.MySQLProfileProvider,MySql.Web,Version=6.3.6.0,Culture=neutral,PublicKeyToken=c5687fc88969c44d" connectionStringName="MySQLConn" applicationName="/" />
        </providers>
    </profile>

    <roleManager enabled="true" defaultProvider="MySqlRoleProvider">
        <providers>
            <clear />
            <add name="MySqlRoleProvider" type="MySql.Web.Security.MySQLRoleProvider,MySql.Web,Version=6.3.6.0,Culture=neutral,PublicKeyToken=c5687fc88969c44d" connectionStringName="MySQLConn" applicationName="/" />
        </providers>

<system.data>
    <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>
</system.data>

My POCO objects:

[XmlRoot(ElementName = "Shop", IsNullable = false)]
[Table("shops")]
public class ShopModel
{
    [Key]
    public int Id { get; set; }

    // must be unique
    [Required]
    public string Name { get; set; }

    public string SiteUrl { get; set; }

    public string LogoUrl { get; set; }

    public string AffiliateSuffix { get; set; }

    public virtual ICollection<ProductModel> ProductModels { get; set; }
}

    [XmlRoot(ElementName = "Product", IsNullable = false)]
[Table("products")]
public class ProductModel
{
    [Key]
    public int Id { get; set; }

    [Required] 
    public string Title { get; set; }

    [Required] 
    public decimal Price { get; set; }

    public string ImageUrl { get; set; }

    public string ProductUrl { get; set; }

    [Required]
    public virtual ShopModel ShopModel { get; set; }
}

My DBContext

    public class MySQLConn : DbContext
{
    public DbSet<ShopModel> Shops { get; set; }
    public DbSet<ProductModel> Products { get; set; }
}

I have created a mock class which creates a new Shop and a new Product object, like this
ctx.Shops.Add(new ShopModel{ … });
ctx.Savechanges(); // code stops here

When I run my code i get the following error:

Table ‘schemeName.shops’ doesn’t exist

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: MySql.Data.MySqlClient.MySqlException: Table ‘schemeName.shops’ doesn’t exist

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T04:55:09+00:00Added an answer on May 26, 2026 at 4:55 am

    I’ve found a solution for this problem. You have to get the latest version of Connector/NET 6.4.4. Add the database intializer. Add Persist Security Info=true to your connection string. I did all this and mine is works perfectly.

    Also noticed that if you already have an existing database, EF might throw you an EntityDataModel exception. You might have to drop the previous database manually before EF would automatically create both the Database and the tables. From then on any changes you make to your models and DBContext automatically reflect in the Database.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When using Grails 1.1 together with a MySQL the charsets of the auto-generated database
I am using MySQL .net connector 6.4.4.0 and Entity Frame work 4.1 and trying
I am wondering if anyone can suggest solutions for adding together datetimes in mysql?
I'm piecing together an image website. The basic schema's pretty simple MySQL, but I'm
i am connecting access to a mysql db. i need to put together two
As I put together each asp.net page It's clear that most of the time
I am trying to use both mysqli_real_escape_string and trim together before making a MySQL
In MySQL Im having two tables: PRODUCTS (id, Name) SEEALSO (id, prodLeft, prodRight) SEEALSO
I have a little php/mysql app I put together that takes an input form
I have been trying to join 4 tables together so I can retrieve data

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.