Jerry Nixon
Jerry Nixon

Reputation: 31803

In WCF Data Services, how can I change the visible name of my entities?

Using WCF Data Services I am using a data model that contains entities with names specific to the model. I would like to expose them through Odata but with different names.

For example, we have an entity called UserWithLeastPrivilege and that is a problematic name to say the least. I would like the Odata client to simply see User. Can you do this?

This:

<service>
  <workspace>
    <atom:title>Default</atom:title>
    <collection href="UsersWithLeastPriv">
      <atom:title>UsersWithLeastPriv</atom:title>
    </collection>
  </workspace>
</service>

Becomes:

<service>
  <workspace>
    <atom:title>Default</atom:title>
    <collection href="User">
      <atom:title>User</atom:title>
    </collection>
  </workspace>
</service>

Upvotes: 1

Views: 252

Answers (1)

Vitek Karas MSFT
Vitek Karas MSFT

Reputation: 13310

Unfortunately this is not easy to achieve. The EF provider doesn't allow this kind of customization currently. You would have to implement a custom provider over your EF model which is a LOT of work.

Upvotes: 2

Related Questions