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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T18:24:21+00:00 2026-05-28T18:24:21+00:00

When I first built the website, I was using EF4 Code First (without migrations).

  • 0

When I first built the website, I was using EF4 Code First (without migrations). Now my client asked me for some new features which required some refactoring of my code base. Part of the refactoring was to move my model into a separate assembly (which should’ve been done right from the start, but I did not know at that time). So anyway, now that my whole code base is changed, and almost all assembly names and namespaces were changed as well, when I deployed the website to the staging environment, EF regenerated the test database.

So my question is there anything that could be done to avoid that? I haven’t used migrations yet but is that a viable solution?

P.S: I would also like to know why that happened, I did not really change any property of any model class. Could it be that now that they belong to another namespace, they were seen by EF as a completely new model?

  • 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-28T18:24:22+00:00Added an answer on May 28, 2026 at 6:24 pm

    If you are sure that you didn’t change any table try to add:

    Database.SetInitializer<YourContext>(null);
    

    to initialization of your application. It will remove any initialization strategy from your application an it will not create database anymore.

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

Sidebar

Related Questions

Just started learning mvc3. I've built a fairly basic website (also using EF-Code-First if
First of all (in case this is important) I'm using ActiveState's Perl (v5.8.7 built
We have a flash website built using flex and CS3. Majority of the site
I have an existing complex website built using ASP.NET MVC, including a database backend,
this is my first time using any StackExchange website, so let's see how it
I have built a very simple CakePHP website using the Auth component and have
I'm using the Facebook C# SDK for build an website with some facebook integration
I'm using Meioupload on a website built with CakePHP, and it is working fine
when i built my first all html/css website i used clickable images as a
I've been ruining Christmas with this problem. We have this website which was BUILT

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.