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 7564521
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T13:55:44+00:00 2026-05-30T13:55:44+00:00

I created new project and added the newest entity framework to it (version 4.3).

  • 0

I created new project and added the newest entity framework to it (version 4.3). I created classes and the context as in previous EF versions. However, during the very first run when the database should be created (in my case it is SQL Server 2005), I’m receiving the following error:

An error occurred while executing the command definition. See the inner exception for details.

With the following inner exception:

Invalid object name ‘dbo.__MigrationHistory’.

As I understand, this table is for migrations, but this table does not exist if there is no database. Am I doing something wrong?

More info:
For testing purposes I created only one class:

public class Test
{ 
  [Key]
  public int TestId { get; set;}

  public string Name {get; set;}
}

public class Context : DbContext
{
   public Context() : base("MyConnection")
   {
   }

   public DbSet<Test> Tests { get; set;}
}

UPDATE 1

After some tests I realized that application is throwing unhandled exception from visual studio and break in visual studio. The exception was System.Data.EntityCommandExecutionException. Once I ignored that expection and didn’t stop code execution, database was created.

UPDATE 2

After another few hours working with database I found out that playing with Enable-Migrations option and Update-Database from console also is solving that issue. It is creating database before application start and don’t break in Visual Studio.

  • 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-30T13:55:46+00:00Added an answer on May 30, 2026 at 1:55 pm

    Could you try removing your constructor to make EF use it’s default connection string.

    public Context() : base("MyConnection")
    {
    }
    

    Failing that, could you try updating your database from the Package Manager Console to see if you get any further information.

    Update-Database -Verbose
    

    Possibly unrelated in your case, but I get the same error when using MvcMiniProfiler 1.9. If you are using it too, make sure EF profiling is turned off by commenting out the line:

    //MiniProfilerEF.Initialize();
    

    Within the MiniProfiler App_Start.


    For others experiencing a similar issue, I have found that reenabling migrations from the Package Manager Console can help in certain cases. Make sure you have a copy of your Migration configuration before doing this.

    Enable-Migrations -Force
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've created a new project in VS2008, and added a .MDF file to the
I've created a new vs.net project and added all the files from an asp.net
In web application, i am created one new project in that i added class
I created new web project testweb. By default default output folder is testweb\build\classes .
In VS 2010 created a new WinForm project. Added a new UserControl WPF. 2
I've created a new project in .Net (2010 4.0) and added an SDF data
I have created a New Dynamic Project under Eclipse Helios Version, where my JRE
I created a new project with the following code segment: char* strange = (Strange??);
How do i run TestCase 's from the IDE? i created a new project,
I've created a new C++ project in Visual Studio 2008. No code has been

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.