Search code examples
wcflinq-to-sqlwcf-data-services

WCF Data service DataServiceKey attribute not working


I am beginning the development of a WCF Data Service project. I received the infamous exception:

The exception message is 'On data context type 'DataClasses1DataContext', there is a top IQueryable property 'table1' 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

I modified the partial class of my entity with the DataServiceKey attribute. However, I am still receiving the same error. How can I fix it?

Thanks!


Solution

  • Just like Vitek said, the solution has been to add refernces to Microsoft.Data.Services and Microsoft.Data.Services.Client to my project that uses the DataServiceKey attribute.