【问题标题】:OData Client Code Generator not generatingOData 客户端代码生成器未生成
【发布时间】:2015-04-16 18:23:27
【问题描述】:

我已经安装了来自https://visualstudiogallery.msdn.microsoft.com/9b786c0e-79d1-4a50-89a5-125e57475937的OData客户端代码生成器tt模板

并尝试将它们指向我的 ASP MVC OData 端点,还尝试了 Edmx,但都无法正常工作。我设法保存了 tt 文件,但生成的 ODataClient.cs 文件为空。

这是我的 ASP MVC OData 读取方式(无需登录和身份验证)

<service xml:base="http://xxx.azurewebsites.net/odata">
  <workspace>
    <atom:title type="text">Default</atom:title>
    <collection href="Accesses">
      <atom:title type="text">Accesses</atom:title>
    </collection>
    <collection href="Badges">
      <atom:title type="text">Badges</atom:title>
    </collection>
    <collection href="BadgeTypes">
      <atom:title type="text">BadgeTypes</atom:title>
    </collection>
    <collection href="BookingItems">
      <atom:title type="text">BookingItems</atom:title>
    </collection>
    <collection href="Bookings">
      <atom:title type="text">Bookings</atom:title>
    </collection>
    <collection href="BookingStatuses">
      <atom:title type="text">BookingStatuses</atom:title>
    </collection>
    <collection href="Countries">
      <atom:title type="text">Countries</atom:title>
    </collection>
    <collection href="Holidays">
      <atom:title type="text">Holidays</atom:title>
    </collection>
    <collection href="Hotels">
      <atom:title type="text">Hotels</atom:title>
    </collection>
    <collection href="HotelStatuses">
      <atom:title type="text">HotelStatuses</atom:title>
    </collection>
    <collection href="RackRates">
      <atom:title type="text">RackRates</atom:title>
    </collection>
  </workspace>
</service>

【问题讨论】:

    标签: asp.net-mvc odata


    【解决方案1】:

    我发现我正在尝试针对 OData v3 生成客户端。升级到 v4 后就可以正常使用了。

    在 OData url 末尾添加 "/$metadata" 以检查您正在使用的 OData 版本。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-03-04
      • 1970-01-01
      • 2022-01-15
      • 2019-09-23
      • 1970-01-01
      • 2015-09-20
      • 1970-01-01
      相关资源
      最近更新 更多