title: WCF Data Service and Azure Table Storage: How can I use PartitionKey / RowKey as primary keys
body: <p>Why does the following code of my entity "Person" generates an error in my WCF Data Service:</p>
  
  <pre><code>[System.Data.Services.Common.DataServiceKey("PartitionKey", "RowKey")]
  public class Person : TableServiceEntity
  {
      public string Name { get; set; }
      public int Age { get; set; }
      ... etc
  </code></pre>
  
  <p>Error:</p>
  
  <blockquote>
    <p>Request Error</p>
    
    <p>The server encountered an error processing the request. The exception
    message is 'On data context type 'PersonDataServiceContext', there is
    a top IQueryable property 'Person' whose element type is not an entity
    type. Make sure that the IQueryable property is of entity type or
    specify the IgnoreProperties attribute on the data context type to
    ignore this property.'. See server logs for more details. The
    exception stack trace is: </p>
    
    <p>at
    System.Data.Services.Providers.ReflectionServiceProvider.PopulateMetadata(IDictionary<code>2
    knownTypes, IDictionary</code>2 childTypes, IDictionary<code>2 entitySets) at
    System.Data.Services.Providers.BaseServiceProvider.LoadMetadata() at
    System.Data.Services.DataService</code>1.CreateMetadataAndQueryProviders(IDataServiceMetadataProvider&amp;
    metadataProviderInstance, IDataServiceQueryProvider&amp;
    queryProviderInstance, BaseServiceProvider&amp; builtInProvider, Object&amp;
    dataSourceInstance) at
    System.Data.Services.DataService<code>1.CreateProvider() at
    System.Data.Services.DataService</code>1.HandleRequest() at
    System.Data.Services.DataService`1.ProcessRequestForMessage(Stream
    messageBody) at SyncInvokeProcessRequestForMessage(Object , Object[] ,
    Object[] ) at
    System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object
    instance, Object[] inputs, Object[]&amp; outputs) at
    System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc&amp;
    rpc) at
    System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc&amp;
    rpc) at
    System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31(MessageRpc&amp;
    rpc) at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean
    isOperationContextSet)</p>
  </blockquote>
  
  <p>What am I doing wrong? 
  If I add a property called PersonID, the error is gone, but I need to access my entity through the PartitionKey and RowKey, and the DataServiceKey decoration in the class is not doing anything.</p>
  
  <p>I'm using Visual Studio 2012, .NET Framework 4.0, Silverlight 5.</p>