title: Entity Framework in n-Tier
body: <p>Using a simple example: </p>
  
  <ul>
  <li>Presentation Tier : aspx and code behind. </li>
  <li>Business Tier: WCF with
  related logics </li>
  <li>Data Access Tier: WCF with entity framework</li>
  </ul>
  
  <p>When I want to populate a grid view, there will be a need to call a method form the business logic, which in turns call the data access tier's method.</p>
  
  <p>The methods and related logic are as follow.  </p>
  
  <p>Data Access Tier:</p>
  
  <pre><code>public SampleEntity[] LoadSampleEntity()
  {
     //retrieve SampleEntity from database.
  }
  </code></pre>
  
  <p>Business Logic Tier:</p>
  
  <pre><code>public SampleEntity[] GetSampleEntity()
  {
     //call the proxy to access Data Access Tier
     //Call LoadSampleEntity()
  }
  </code></pre>
  
  <p>Presentation Tier:</p>
  
  <pre><code>protected void btn_OnClick()
  {
     //call the proxy to access Business Logic Tier
     //Call GetSampleEntity()
     //SampleEntity[] sampleEntity=BusinessLogic.GetSampleEntity();
     //gridview.datasouce = sampleEntity
     //gridview.databind();
  }
  </code></pre>
  
  <p>Given this structure, if SampleEntity was modified, all the 3 tiers will require re-compiling.<br>
  Is there any way to reduce the need of re-compiling when new property/column is added to SampleEntity . </p>
  
  <p>One way which I have worked on will be to convert SampleEntity[] to datatable type at Business Logic Tier, and pass the datatable over to Presentation Tier. However doing so removes the intellisense feature of EntityFramework in the Presentation Tier.</p>