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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:38:39+00:00 2026-05-26T10:38:39+00:00

I have a few questions about creating a database from a model. Is it

  • 0

I have a few questions about creating a database from a model.

Is it possible to do this at runtime? I know you can generate the create sql in the designer but what about during runtime?

Can you create the DDL without creating a connection? Just kind of annoying to add a connect for the sole purpose of creating the DDL.

Is there an automatic way to handle alters? Like if I update the entity/table am I going to have to manually alter the table or is there anything to handle that?

Whats going on in EntityContext.CreateDatabase for sqlce? When I call it I have to recreate the context otherwise I cannot create the tables as they already ‘exist’. But they don’t really exist as any inserted data is not saved.

  • 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-26T10:38:39+00:00Added an answer on May 26, 2026 at 10:38 am

    Absolutely. If your database doesn’t exist it will create it if you’ve specified
    In your constructor:

    
    static EntityContext()
    {
    //for example to create a db:
    Database.SetInitializer(new CreateDatabaseIfNotExists());
    }
    
    

    What do you mean by recreating the context? If you specify Database. in your initialization, SQL CE database will be created.
    Unfortunately the model becomes the initial source of changes. Future changes need to be made to both the database and the model.

    Your SQL CE connect string is as such:

    <add name="EntityDemoSite.DataAccess.EntityContext" connectionString="Data Source=|DataDirectory|test.sdf" providerName="System.Data.SqlServerCe.4.0" />
    

    note that the ‘name’ should match the full namespace of the context class.

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

Sidebar

Related Questions

I have a few questions about this after reading the iPhone documentation on it:
There have been a few articles and questions about how to do this but
Im a newbie PHP programmer and I have a few questions about creating a
I have a few questions about data synchronization. The architecture does not seem to
I have a few questions about Xcode and interaction with GCC 4.2.1: It doesn't
I have a few questions about cross-page posting in ASP.NET: What is cross-page posting
I have a few questions about Core Location. 1) Should the user refuse permission
I have a few quick questions about the Microsoft Detours Library. I have used
I've been hearing about triggers, and I have a few questions. What are triggers?
There have been several questions over the past few days about the proper use

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.