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

  • SEARCH
  • Home
  • 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 7837255
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T14:32:39+00:00 2026-06-02T14:32:39+00:00

I am using Entity Framework (4.3) migrations. I have a config class as normal

  • 0

I am using Entity Framework (4.3) migrations. I have a config class as normal that defines a Seed method, which is supposed to called after the migrations to add the data:

internal sealed class SettingsConfig : DbMigrationsConfiguration<My.Assembly>
{
    public SettingsConfig()
    {
        AutomaticMigrationsEnabled = false;
    }

    protected override void Seed(ScannerAreaManager.DataAccess.CableSenseLocal context)
    {
        //  This method will be called after migrating to the latest version.
    }
}

I’m running SQL Server profiler to see what’s happening to the database.

Now, if I delete the database, and run this application from Visual studio with F5 (attached to debugger), it runs, and I can see the database gets created, migrations run, and the seed method being called and adding data to the database

If I then delete my database, and run the application again with Ctrl-F5 (NOT attached to the debugger), then I see my database gets created, the migrations run, but the seed method never gets called.

Surely this isn’t by design? Any ideas?

  • 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-06-02T14:32:41+00:00Added an answer on June 2, 2026 at 2:32 pm

    My bad, this was caused by our code attempting to read from the context before it had been initialised – but only when not run in debug mode.

    EF does indeed behave as expected – the seed method gets called after the migrations have executed.

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

Sidebar

Related Questions

I have created a new application using Entity Framework 4.3 database migrations. The migrations
I'm using Entity Framework in my project, and I have the problem that, once
I've recently started using Entity Framework migrations and noticed that the database name is
Using Entity Framework with MVC2, I have a series of date textboxes, that I
I am using Entity Framework with my website. To improve performance, I have started
I have been using Entity Framework 4.3 on an existing database and I have
I'm trying the latest Entity Framework Migrations beta 01 release. It works fine using
Using Entity Framework. Simple Page class with tree hierarchy. public class Page { public
Using Entity Framework I have the fields: o CreatedOn (datetime) o CreatedBy (nvarchar(50)) o
I am using Entity Framework CodeFirst where I have used Parent Child relations using

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.