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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T02:45:37+00:00 2026-06-10T02:45:37+00:00

I have ~300 DbSets in my context and the first query after app load

  • 0

I have ~300 DbSets in my context and the first query after app load (a FirstOrDefault() where on an indexed field) takes ~40 seconds.

To improve this, I am attempting to use pregenerated views in EF 4.3.1 Code First using the T4 template here:

http://blog.3d-logic.com/2012/06/13/entity-framework-codefirst-view-generation-templates-on-visual-studio-code-gallery/

I compile it in, but I see no performance difference. I was hoping/assuming it would help the painful slow startup I am experiencing, but no luck.

Should it help? If not, what exactly are pregenerated views used for? And, is there anything I can do to improve startup time? Splitting my context up is painful to say the least.

  • 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-10T02:45:39+00:00Added an answer on June 10, 2026 at 2:45 am

    It turns out that it actually seems to search for the pregenerated views in the assembly where the first referenced entity is, not in the assembly where the DbContext is. See more discussion here: http://blog.3d-logic.com/2012/06/13/entity-framework-codefirst-view-generation-templates-on-visual-studio-code-gallery/#comment-76.

    To work around this, I made up a new entity and put it in the context’s assembly, and listed it as the first DbSet. Now it picks it up, and works well (except that this is ridiculous).

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

Sidebar

Related Questions

I have this SQL query (in T-SQL): --DECLARE @strTerm varchar(300) --SET @strTerm = 'c'
I have site which uses $(selector).load(path) function in more than 300 pages. Now my
HI All I was hoping someone could help me improve a query I have
I have an 300 rows(data) each page contain 10 records I need first 10
I have field in my sql table named 'content'. I have 300 records in
I have a 300 x 300 sized UIImageView in my app which is displaying
I have table with 300 000 records (MyISAM). I get record from this table
I have a ListView that shows around 300 items. When something is changed and
I have many (>600) EPS files(300 KB - 1 MB) in database. In my
I have a switch statement that has over 300 case statements. case 'hello': {

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.