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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T20:40:46+00:00 2026-06-10T20:40:46+00:00

I am programming with EF5-code first and want to use LocalDb. How can I

  • 0

I am programming with EF5-code first and want to use LocalDb. How can I change the default location of LocalDb database file? Default location is %USERPROFILE% directory according to http://blogs.msdn.com/b/sqlexpress/archive/2011/10/28/localdb-where-is-my-database.aspx

Previously I was using SqlCe DbConnectionFactory which accepts a parameter for database path/name. If I use AttachDbFileName parameter then it raises an exception if database doesn’t exist (it’s supposed to create it!).

  • 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-10T20:40:47+00:00Added an answer on June 10, 2026 at 8:40 pm

    I got this working thanks to this post. The answer is simple. Basically I added

      <connectionStrings>
    <add name="DataModel.Context" connectionString="Data Source=(LocalDb)\v11.0;Initial Catalog=database;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\database.mdf" providerName="System.Data.SqlClient" />
    

    to the configuration section of app.config and it magically replaced the “database” with my actuall database (DbContext) name. EF code first also works perfectly to create the database if it doesn’t exist.

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

Sidebar

Related Questions

In programming you can use the this keyword this.Textbox or just Textbox What is
Programming language: Java Ok, so I want to have a BufferedImage that keeps rotating
Programming has come a long way. I am still relatively young (first Computer: C64),
Android programming. I have a json returning the date from a database as a
Programming language: DrRacket/scheme Hey guys, I am preparing for my first comp sci midterm,
When programming through sockets in C, one can automatically get information about their interfaces
When programming for Android sometimes you have to use static methods. But when you
Programming Language I am using : PHP I have 30 results from database, which
Programming an iPhone App, I need to use Google Maps api to get directions
Programming Question First (from w3 schools) The programming example way below (from W3 schools)

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.