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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T16:24:03+00:00 2026-05-31T16:24:03+00:00

I am doing a project, where I am going to use Entity Framework 4.1.

  • 0

I am doing a project, where I am going to use Entity Framework 4.1. I am planning on doing the “Code-First” approach, as I like clean entities and I want to extend them in some fashion.

I have an existing empty database, that I would like to use. I have setup the connection string as below, and I have set EF to always drop and create database (to start with). And this is my problem.

I have access to this empty database, but I don’t have permissions to drop it and/or create it. The database is already there ready to use. How can I get EF to use the database as it is, instead of dropping and creating it?

By the way, if I doesn’t set it to drop and create, it complains about that it cannot find the tables, which is understandable.

  • 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-31T16:24:04+00:00Added an answer on May 31, 2026 at 4:24 pm

    In order to use EF Code First with an existing empty DB you will need to use a custom database initializer, that does not recreate the DB but only the tables, luckily somebody did this already:

    http://blogs.microsoft.co.il/blogs/gilf/archive/2011/05/30/creating-a-code-first-database-initializer-strategy.aspx

    You should also have a look at the new Database Migration functionality of EF 4.3 this becomes important as your schema evolves.

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

Sidebar

Related Questions

I'm doing project where i'm going to use Jquery and ajax. I'm starting to
I'm planning a ASP.NET project for which I'm going to use AJAX. I'm researching
I'm doing a project. I'm not going to details but I will simplify my
I am doing project in cakephp . I want to write below query in
I have started to look at the Entity Framework for a project I am
I have recently started a fairly large web project which is going to use
I'm about to work on a project that's hopefully going to use an electronic
I'm doing my first project with MEF and am seriously unable to understand how
I am doing some research for some social network project which i am going
I am doing my dissertation project on NP-Hard Problems: I am going to implement

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.