title: Take the database's value over the get{} value
body: <p>I have been using the following technique for fudging calculated values in my database.</p>
  
  <pre><code>public class Invoice
  {
      public ICollection&lt;Line&gt; Lines {get;set;}
  
      [AlwaysUpdate]
      public Decimal Total { get { return this.CalcTotal; } set{} }
  
      public Decimal CalcTotal
      {
          get
          {
               return this.Lines.Sum( l =&gt; l.Price * l.Quantity );
          }
       }
  }
  </code></pre>
  
  <p>This technique allows me to store a total of the invoice in my database, and if Lines change at all, Total is automatically updated and saved thanks to my <code>[AlwaysUpdate]</code> attribute.</p>
  
  <p>If I query invoices like so:</p>
  
  <pre><code>_repository.Invoices.Select( i =&gt; i.Total );
  </code></pre>
  
  <p>Entity framework will go and fetch the DB's total and not call <code>CalcTotal</code>.</p>
  
  <p>However, if I do this:</p>
  
  <pre><code>_repository.Invoices.ToList().Select( i =&gt; i.Total );
  </code></pre>
  
  <p>Entity framework will call <code>CalcTotal</code>.</p>
  
  <p>Usually this is the behavior I want, but I have an issue with a certain query now.  I have to use <code>ToList</code> to fetch all records into memory, but I don't want to call <code>CalcTotal</code> on every item.  </p>
  
  <p>Is there a way to change my little hack here to support not calling <code>CalcTotal</code> all the time?</p>