title: ADO.NET Entity Framework - Pre-Generate Views -
body: <p>We are using ADO.NET Entity for our ASP.NET application.</p>
  
  <p>I have read that the pre-generated views improves the performance. Referred to the blog post, </p>
  
  <p><a href="http://blogs.msdn.com/adonet/archive/2008/06/20/how-to-use-a-t4-template-for-view-generation.aspx" rel="nofollow noreferrer">http://blogs.msdn.com/adonet/archive/2008/06/20/how-to-use-a-t4-template-for-view-generation.aspx</a>, I generated the views. The namespace &amp; classes generated as</p>
  
  <pre><code>namespace Edm_EntityMappingGeneratedViews
  {
  
  
      /// &lt;Summary&gt;
      /// The type contains views for EntitySets and AssociationSets that were generated at design time.
      /// &lt;/Summary&gt;
      public sealed class ViewsForBaseEntitySets4D4A6E0AA7AF6B2298FABB4F22235831 : System.Data.Mapping.EntityViewContainer
      {
  
          /// &lt;Summary&gt;
          /// The constructor stores the views for the extents and also the hash values generated based on the metadata and mapping closure and views
          /// &lt;/Summary&gt;
          public ViewsForBaseEntitySets4D4A6E0AA7AF6B2298FABB4F22235831()
          {
              this.EdmEntityContainerName = "JSEntities";
  </code></pre>
  
  <p>I added this to my data layer and test the performance. Couldn't see much improvement. CPU usage always goes to 20-30% utilization (response timing is good) and reduce back to 0% in 500ms - 1 sec. I think the CPU utilization goes high because of view generation every time.</p>
  
  <p>I couldn't understand how the entity framework knows that this is my pre-generated view class for my model eventhough the MyModel.edmx &amp; MyModel.Views.cs matches with filename.</p>
  
  <p>Should I have to update Web.Config or App.Config to map the View class to model somewhere?</p>
  
  <p>Please clarify.</p>