Search code examples
namespacesentitywcf-data-services

Change shown entity namespace in WCF Data Service with custom reflection service


I'm trying to get my WCF Data Service to show a different entity namespace in the resulting xml from the entity's real namespace.

Consider this Netflix OData service http://odata.netflix.com/v2/Catalog/Languages?$select=Name

Every entry looks like this

<entry>
    ...
    <category term="Netflix.Catalog.v2.Language" .../>
    ...
</entry>

In my own code the "category term" value is the namespace of my entity class and it's not as clean as I would like. In fact it's OurProductName.CustomerName.Web.RestApi.v2.Entities.Entityname.

Is it possible to change this by setting an attribute on the entity or some other way?

Regards, Mathias


Solution

  • If you're using the reflection provider then this can't be changed currently. It is possible to write a custom provider in which case you can rename anything, but it's much more work.