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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T12:57:11+00:00 2026-06-13T12:57:11+00:00

As part of our intended migration from Linq2Sql to Entity Framework, we have created

  • 0

As part of our intended migration from Linq2Sql to Entity Framework, we have created a small EF model consisting of ten entities. Because we are working with a legacy application we are using the ‘code first’ option and manually mapping our POCO objects to tables within the database. We do not want the Entity Framework code to update the database. I believe that the following is all I need to do to achieve this – I would appreciate confirmation as I was not sure whether the SetInitializer code should go here or perhaps in the Global.asax code.

protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
    Database.SetInitializer<InboxDataContext>(null);

    modelBuilder.Configurations.Add(new Subscribers.Mapping.DataSourceMap());
    modelBuilder.Configurations.Add(new Subscribers.Mapping.SubscriberMap());
    ...
}

As part of this update, we have created a small test page (MVC controller and views) and added it to our main application project. During development and testing this has worked well. The only thing we did notice is that if we updated the underlying EF model, the initial page load seemed to take several minutes to render. I assumed this was because EF had to rebuild its views and mappings to reflect the changes – to my disgrace, I didn’t worry too much about this as a) I don’t have a full understanding of how this works and b) it only seemed happened on model changes.

This morning we loaded this update to the production server for initial testing and this time the initial load problem became much worse – so much so in fact that the test page never loaded.

So, to get to my questions:

  1. Is there anything else I should/should not be doing to prepare my
    application for production?
  2. How can I improve the initial load performance?
  3. How can I find out why the initial load on the production server
    never completes – I am not seeing any error messages?

I did try downloading the Entity Framework Power Tools and running the ‘Generate Views’ option on the derived DbContext class, but since I could only run this in the development environment I was not sure whether this would work when copied to the production server – it didn’t appear to.

I should mention that the development environment contains just one hundred records in the main table and the production environment contains almost one million records (same schemas), again I wasn’t sure if this would make any difference.

Any help advice would be appreciated.

Thanks.

  • 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-13T12:57:12+00:00Added an answer on June 13, 2026 at 12:57 pm

    Firstly, if you are using an existing database then a better approach would be Model First. You can connect your Edmx to your current database and it will gather all the required mappings as they currently stand. It then also generates the POCO classes and DbContext (with EF5, you have to do it manually in <5). Using this approach may cut down on initialisation time as your code wont have to create a model at runtime.

    Give this a try, and it might solve all your problems (I believe they are all related).

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

Sidebar

Related Questions

As part of our migration from VS 2010 to VS 2012 we have begun
As part of our migration from .net 1.1 to .net 3.5, we had to
As part of our web application's build process, I have set up our XSLT
We have a part of our program which can save a diagnostic file for
As part of our University coursework we have to make a multi threading download
As part of our Visual Studio 2010 (primarly C# 4.0) development standards, we have
The file system part of our asp.net application framework requires updating to fall inline
We have some scripts that we run as part of our unit tests. This
As part of our development life cycle we have a number of process that
There is a small part of our software that inserts a string before and

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.