title: Not all Entity properties loaded by EntityDataSource used by FormView
body: <p>I am losing my mind. It's a simple scenario:</p>
  
  <p>Entity definition (generated)</p>
  
  <pre><code>// this class is obviously generated by the designer, this is just an example
  public class SomeEntity {
    public int SomeEntityID { get; set; } // primary key
    public String Property1 { get; set; }
    public String Property2 { get; set;
  }
  </code></pre>
  
  <p>.. in aspx file</p>
  
  <pre><code>&lt;asp:EntityDataSource 
  ID="EntityDataSource1" runat="server"
  ConnectionString="name=Connection" DefaultContainerName="SomeEntities"
  EnableDelete="True" EnableInsert="True" EnableUpdate="True"
  EntitySetName="SomeEntity" OnUpdating="UpdatingEntity" AutoGenerateWhereClause="true"&gt;
  &lt;WhereParameters&gt;
    &lt;asp:QueryStringParameter Name="SomeEntityID" QueryStringField="SomeEntityID" Type="Int32"/&gt;
  &lt;/WhereParameters&gt;
  &lt;/asp:EntityDataSource&gt;
  &lt;asp:FormView runat="server" ID="FormView1" DataSourceID="EntityDataSource1"&gt;
     &lt;EditItemTemplate&gt;
      &lt;asp:TextBox runat="server" ID="textbox1" Text='&lt;%# Bind("Property1")%&gt;'
     &lt;/EditItemTemplate&gt;
  &lt;/asp:FormView&gt;
  </code></pre>
  
  <p>... in code behind</p>
  
  <pre><code>// ... as per Diego Vega's unwrapping code
  public TEntity GetItemObject&lt;TEntity&gt;(object dataItem)
      where TEntity : class
  {
      var entity = dataItem as TEntity;
      if (entity != null)
      {
          return entity;
      }
      var td = dataItem as ICustomTypeDescriptor;
      if (td != null)
      {
          return (TEntity)td.GetPropertyOwner(null);
      }
      return null;
  }
  protected void UpdatingEntity(object sender, EntityDataSourceChangingEventArgs e) {
    SomeEntity entity = GetItemObject&lt;SomeEntity&gt;(e.Entity);
    // at this point entity.Property1 has the value of whatever was entered in the 
    // bound text box, but entity.Property2 is null (even when the field bound to this
    // property in the database contains a value
    // if I add another textbox to form view and bind Property2 to it ... then I can
    // obviously get its value from the entity object above 
   }
  </code></pre>
  
  <p>Basically ONLY the properties bound in the form view have their values available in the Updating event handler, worse still when I try to reload the entity from e.Context by key, I get only those properties again.</p>
  
  <p>What gives? How can get access to all the properties of the entity in the Updating event?
  Also if the datasource contains Include, those included values are NOT available in the Updating event. What's going on, please HELP!</p>