6
Tôi đang cố sử dụng nhà cung cấp loại ODataService với Netflix. Điều này hoạt động tốt:Không có thuộc tính 'HasValue' nào tồn tại đối với không có giá trị int cho Nhà cung cấp Loại ODataService
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
nhưng trả về tất cả các tập của chương trình truyền hình Godzilla, không có ngày phát hành (boo). Vì vậy, tôi cập nhật truy vấn của tôi để:
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
Và tôi phải đối mặt với các lỗi sau:
<?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>
Uh, HasValue không tồn tại cho ints nullable? Kể từ khi?
tôi phải chuyển đổi các lựa chọn cho 'chọn (t.Name, t.ReleaseYear.Value)' nhưng hoàn hảo, cảm ơn. – rachel