Remove AttachTo derived type navigation property not working RRS feed

  • Question

  • 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<CategoryBase> 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:


    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.

    • Edited by Woland2k Tuesday, July 24, 2012 11:15 PM more accurate header
    Monday, July 23, 2012 2:11 AM

All replies

  • How did you start tracking the Category entity on the client. Did you get it by executing a query from the server (GET on the CategoryBases('123') or something similar), or did you attach it by using DataServiceContext.AttachTo?


    Vitek Karas [MSFT]

    Monday, July 23, 2012 11:53 AM
  • I attach it myself.

    I use 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?

    • Edited by Woland2k Tuesday, July 24, 2012 8:34 AM
    Monday, July 23, 2012 5:47 PM
  • Any help on the issue? Seems like a bug in the WCF that needs to be addressed.
    • Edited by Woland2k Wednesday, July 25, 2012 6:52 AM
    Wednesday, July 25, 2012 6:52 AM
  • Sorry, I just confirmed that this is indeed a bug in the WCF DS Client library. I don't think there's a workaround right now.

    Vitek Karas [MSFT]

    Wednesday, July 25, 2012 3:34 PM
  • Is there any schedule on when this bug will be fixed? Will it be part of 5.1 release?
    Thursday, July 26, 2012 5:21 AM
  • We may be able to fix this in the 5.1 timeframe, but I cannot promise anything right now.

    For now, you will have to issue a query for the entry when it has derived navigation properties rather than using AttachTo. Note that this is not specific to DeleteLink, it is a problem with how AttachTo guesses the edit-link of the entity

    Matt Meehan (WCF Data Services / OData)

    Friday, August 17, 2012 9:26 PM