【问题标题】:In WCF Data Services, how can I change the visible name of my entities?在 WCF 数据服务中,如何更改实体的可见名称?
【发布时间】:2011-10-12 03:41:05
【问题描述】:

使用 WCF 数据服务 我使用的数据模型包含具有特定于模型名称的实体。我想通过 Odata 公开它们,但名称不同。

例如,我们有一个名为 UserWithLeastPrivilege 的实体,至少可以说这是一个有问题的名称。我希望 Odata 客户端只看到 User你能做到吗?

这个:

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

变成:

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

【问题讨论】:

    标签: c# entity-framework wcf-data-services


    【解决方案1】:

    不幸的是,这并不容易实现。 EF 提供程序当前不允许这种自定义。您必须在您的 EF 模型上实现一个自定义提供程序,这需要大量工作。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-02-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-02-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多