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>
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.
精彩评论