我正在尝试将 ODataService 类型提供程序与 Netflix 一起使用。这工作正常:
type internal NetflixData = ODataService<"http://odata.netflix.com/Catalog/">
let internal NetflixContext = NetflixData.GetDataContext()
let godzillamovies = query { for t in NetflixContext.Titles do
where (t.Name.Contains "Godzilla")
select (t.Name, t.ReleaseYear)
} |> Seq.toList
但返回哥斯拉电视节目的所有剧集,没有发布年份日期(嘘)。因此,我将查询更新为:
let godzillamovies = query { for t in NetflixContext.Titles do
where (t.Name.Contains "Godzilla" && t.ReleaseYear.HasValue)
select (t.Name, t.ReleaseYear.Value)
} |> Seq.toList
我遇到了以下错误:
<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>
<error xmlns=\"http://schemas.microsoft.com/ado/2007/08/dataservices/metadata\">
<code></code>
<message xml:lang=\"en-US\">No property 'HasValue' exists in type 'System.Nullable`1[[System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]' at position 45.</message>
</error>
呃,可空整数不存在 HasValue 吗?从何时起?