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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T06:34:03+00:00 2026-06-04T06:34:03+00:00

I have a MVC3 website I have been playing with, and the database is

  • 0

I have a MVC3 website I have been playing with, and the database is quite well populated. I need to change the underlying models, but of course, the standard approach would drop all data. Having the CREATE SQL (so I can ensure all fields/relationships are in line with the models), and the calculated hash (so EF thinks the models match the database) would allow me to manually make changes to the database.

Is there a way to interrogate a DataContext (or some other object) to:
1. Get the SQL it would use to generate the dataschema; and
2. Get the ERM Metadata hash

I have considered some other migration options, but just want to explore this avenue.

Edit: This is EF4.1, and is running against SQL 2008 R2 if that is of any relevance.

Thanks
Andrew

  • 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-04T06:34:05+00:00Added an answer on June 4, 2026 at 6:34 am

    You can do it with EF Migrations. You’d need to upgrade your project to EF 4.3. You’d use the “Update-Database -Script” ps command.

    Here is a link to the ASP.Net team blog on it: http://blogs.msdn.com/b/adonet/archive/2012/02/09/ef-4-3-code-based-migrations-walkthrough.aspx

    Pluralsight also has a course on it. They also have a free trial. http://www.pluralsight-training.net/microsoft/Courses/TableOfContents?courseName=efmigrations

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

Sidebar

Related Questions

I'm creating a very simplistic MVC3 website. I need to add no database authenication.
If created a website using MVC3 and have a database attached to it. They
I'm building my first MVC3 website and have connected my site to a mdf
I have a website built in mvc3. I want to have an image of
I have a website (ASP.NET MVC3) that runs on IIS 7. From this website,
I have an MVC3 program in which I want to query a database and
I have an mvc3 website that is not styling correctly in IE9 when I
I have an asp.net-mvc3 website using nhibernate and SQL server. I have 2 web
I'm building an ASP.NET MVC3 Website with EF and DB First Approach. I need
I have been working on a website using MVC Preview 1 since it came

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.