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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T18:33:42+00:00 2026-05-22T18:33:42+00:00

From everything I have read, EntityFramework is supposed to be the bees knees, that

  • 0

From everything I have read, EntityFramework is supposed to be the bees knees, that You can use CodeFirst to generate entities from POCO’s. Awesome! I’ve done this, I let the EntityFramework default behavior do its thing, and now I’m stuck with my back against the wall.

Everything I have read about EntityFramework and MVC3 applications, you can just change the DBContext connection string in your web.config and it should auto-sense, cleanse the meta-data it has cached and regenerate, plus call either the default seed or your custom seed method for that context. I beg to differ.

I’ve got a very simple db context class:

namespace AwesomeApp.Models
{
    public class MyContext : DbContext
    {
        public DbSet<Sneeze> Sneeze { get; set; }
    }
}

After having spent a few sprints getting the model in place, working with the controller and views, I’m ready to migrate to a staging environment using SQLServer Express 2008. SO I asked mr google how to do this, and it blatantly states on this blog post, you set the connection string with the entity context as the name, everything else should fall into place.

<connectionStrings>
<add name="MyContext"
     connectionString="Server=server;Database=awesome_sauce;User ID=noob;Password=noob;Trusted_Connection=False;"
     providerName="System.Data.SqlClient"/>

I call shenanigans, as its not creating the table(s) in the database i have listed, and still accessing the default database. This leaves me with 2 problems and i’m positive its borne from my ignorance

  1. Where is the default database located for SQL Server Express (or is it CE) that Entity Framework calls by default?
  2. When you update the connection, is there more interaction required by the programmer to get the achieved behavior of swapping DB’s?
  • 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-22T18:33:43+00:00Added an answer on May 22, 2026 at 6:33 pm

    Here is an example i do using an SQLite DB to dynamically change the path… same logic can be taken for any SQL. I put this in my application.xaml of my WPF app (so prob put in your application_start)

    ' Application-level events, such as Startup, Exit, and DispatcherUnhandledException
    ' can be handled in this file.
    
    Public Sub New()
    
        'Attempt to load the db file
        Dim dbFile As New IO.FileInfo(AppDomain.CurrentDomain.BaseDirectory & "Files\database.s3db")
    
        'Loop till we get liteEntities
        For Each item As System.Configuration.ConnectionStringSettings In ConfigurationManager.ConnectionStrings
            If item.Name <> "liteEntities" Then Continue For
    
            'Allow us to update this ite
            Dim fi = GetType(ConfigurationElement).GetField("_bReadOnly", BindingFlags.Instance Or BindingFlags.NonPublic)
            fi.SetValue(item, False)
    
            'Update it
            item.ConnectionString = Replace(item.ConnectionString, "C:\db\Files\database.s3db", dbFile.FullName)
    
        Next
    
    
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I can't get the jQuery datepicker to work. I have followed everything from the
From everything I've read, it seemed that adding paging to a ListView control should
I have read that Windsor is the best DI/IOC tool to use so I
I have a web application with over 200 configuration settings. These control everything from
I have just Extracted the cells from the excel sheet using Apache POI, everything
I have produced a new Maven Project from gae-archetype-gwt from within IntelliJ, and everything
I have a project in Eclipse. When I run it from inside Eclipse, everything
Well is there? From everything I've read, it seems like the answer is no,but
I'm developing a touchscreen application that, aside from everything else, records the amount of
I currently have an application making use of Authorize.net's ARB API. I have everything

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.