title: Calculated fields and OData / WCF Data Service
body: <p>I am trying to add some calculated fields to my Entity Framework model that is exposed externally using a WCF Data Service, the problem I have is that anything I try doesn't get exposed outside of my service.</p>
  
  <p>I have tried adding the following code (Note: the actual method has business logic in the get/set methods):</p>
  
  <pre><code>public partial class myClass
  {
      [DataMember]
      public string Foo { get; set; }
  }
  </code></pre>
  
  <p>However the field is still not returned in by OData, it seems OData only looks at the .edmx.</p>
  
  <p>Currently the only option I can think of to solve this is to implement a <code>CLR function</code> and have my Entity Framework model look at a SQL <code>view</code> which calls my function for every returned row and calculates the value at the server side, and use stored procedure to update the entity. But I would rather not have to go through all this for what is effectively a simple (in .NET, but not-so in SQL) calculated field.</p>
  
  <p>What other options are open to me for calculating this field?</p>