I’m using the latest WCF DataServices 5.1rc. I know that the derived type navigation properties are supposed be fixed and supported. However I encounter the following issue when trying to DeleteLink for the property.
I have a Category class that is inherited from the CategoryBase class. The Category class has a property called Attributes, I’m trying to remove one of the attributes from the Category class and get an exception “Resource not found for the segment ‘Attributes’ (DataServiceContext based web service exposes “public IQueryable Categories” property).
After examining the request with fiddler i found the following request:
DELETE http://somesite/DataServices/CatalogDataService.svc/CategoryBases('123')/$links/Attributes('23')
which is incorrect since CategoryBases doesn’t contain Attributes, it should be something like this:
http://somesite/DataServices/CatalogDataService.svc/CategoryBases('123')/MyNamespace.Data.Catalogs.Category/$links/Attributes('23')
I looked through the source code of WCF and found that the generation is berried in EntityDescriptor.cs class which is not possible to overwrite. Is this still an issue in the latest WCF or am I doing something wrong?
I know that I can move the property to a CategoryBase to solve the issue, but would rather avoid this.
I also attach the object myself on the client using the following method (it works fine when the object is attached as a result of the query):
client.AttachTo("CategoryBases", category);
when viewing the DataServiceContext.Entities[0].ServerTypeName is null but when I receive categories from the service DataServiceContext.Entities[0].ServerTypeName = ‘MyNamespace.Data.Catalogs.Category’.
How do I fix this?
This is a confirmed bug in WCF 5.1rc. Hopefully it is fixed before the final release.