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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T02:52:45+00:00 2026-05-26T02:52:45+00:00

I am learning Code First development with a console application. In many of the

  • 0

I am learning Code First development with a console application. In many of the examples, including Scott Gu’s post, they suggest using Sql Server CE 4.0 and set it up so that the code creates the database automagically.

I am doing a console app and would like to examine the database with a management tool, such as management studio or linqpad. What is the location of the sdf file that is created?

I created an App.Config and placed the following in it:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <connectionStrings>
    <add
      name="NerdDinners"
      providerName="System.Data.SqlServerCe.4.0"
      connectionString="Data Source =|DataDirectory|NerdDinners.sdf"/>
  </connectionStrings>
</configuration>

However, NerdDinner is not created, and instead a database in SQLExpress is created. I seem to have confused some things here.

  • 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-26T02:52:46+00:00Added an answer on May 26, 2026 at 2:52 am

    It depends upon the connection string you have set in app.config file. In most cases (DataDirectory) database file will be created at Debug\bin folder (winform app).

    Sample app: (Add the ref of System.ComponentModel.DataAnnotations.dll and EntityFramework.dll)

    public class Employee
    {
        [Key]
        public int EmpNo { get; set; }
        public string Name { get; set; }
    }
    public class Test : System.Data.Entity.DbContext
    {
        public System.Data.Entity.DbSet<Employee> Emps { get; set; }
    }
    

    app.config (The name of connection string must match the name of Context class)

    <configuration>
    <connectionStrings>
      <add  name="Test"
              connectionString="Data source=|DataDirectory|Test.sdf" 
              providerName="System.Data.SqlServerCe.4.0"
            />
    </connectionStrings>
    </configuration>
    

    Add a record,

    Test db = new Test();
    
    db.Emps.Add(new Employee() { EmpNo = 1, Name = "Mr.X" });
    db.SaveChanges();
    
    • 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, this is my code (just started learning java): Queue<String> qe =
So, I started learning to code in Python and later Django . The first
This is my first post on this site :-) I'm learning F#. To do
I'm learning ASP.NET MVC 3 with Entity Framework Code First. I'm following a tutorial
I'm currently developing an app using ASP.NET MVC3 and Entity Framework 4.1 Code First
I'm learning Java development and for a homework assignment I've been instructed to code
So I am learning MVC3 and EF4. I tried the code first method but
This is my first time learning json and this is my sample code: $(function
I am learning EF 4 staff and really got stacked. I am using Code

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.