title: Azure Table SDK 2 EntityResolver using reflection
body: <p>I am trying to use <code>EntityResolver</code> to dynamically populate an empty object from an Azure <code>TableResult.Execute</code>, debug doesnt get into the <code>Test</code> method unless you omit the <code>match.SetValue</code> call. It throws an exception stating the below. The actual azure table request is fine and in debug I can see the column values etc, I just need to map it into a local class, ideally using generics and reflection.</p>
  
  <pre><code>Method not found: 'System.Nullable`1&lt;Int32&gt; Microsoft.WindowsAzure.Storage.Table.EntityProperty.get_Int32Value()'.
  </code></pre>
  
  <p>I think the problem is something to do with reflection but need assistance.</p>
  
  <pre><code>public T RetrieveRow(string partitionKey, string rowKey)
      {
          EntityResolver&lt;IObTable&gt; resolver = (pk, rk, ts, props, etag) =&gt; Test(props);
          CloudTable table = base.TableClient.GetTableReference(TableName);
          TableOperation operation = TableOperation.Retrieve&lt;IObTable&gt;(partitionKey, rowKey, resolver);
          TableResult retrievedResult = table.Execute(operation);
          return (T)retrievedResult.Result;
      }
  
  public IObTable Test(IDictionary&lt;string, EntityProperty&gt; storageProps)
      {
          IObTable objectToReturn = (IObTable)Activator.CreateInstance(typeof(T));
          if (storageProps != null)
          {
              var emptyObjectProps = objectToReturn.GetType().GetProperties();
              foreach (var prop in storageProps)
              {
                  PropertyInfo match = emptyObjectProps.FirstOrDefault(v=&gt; v.Name==prop.Key);
                  if (match!=null)
                  {
                      if (match.PropertyType == typeof(Int32))
                      {
                          match.SetValue(prop, storageProps[match.Name].Int32Value);
                      }
                  }
              }
          }
          return objectToReturn;
      }
  </code></pre>
  
  <p><code>IObTable</code> is just a marker interface on my local entity.</p>
  
  <p>Any help much appreciated.</p>