开发者

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

开发者 https://www.devze.com 2023-04-12 04:25 出处:网络
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.

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>


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号