我正在使用eBay的OData服务来查找一定距离内的物品。但是,在尝试这样做时,我得到了一个相当神秘的错误。
<message xml:lang="en-US">
You can only filter by the following properties: Distance/Value.
(e.g. /Items&search=pdc? $filter=ListingInfo/EndTime gt datetime'2010-11-15T17:26:24Z')
</message>
这很奇怪,因为我试图过滤那个非常有价值的东西,为什么服务会抱怨?
以下是我的参考网址:
?http://ebayodata.cloudapp.net/Items() $滤波器=距离/值%20LE%20250.0&安培; $选择=标题,ViewItemUrl,CurrentPrice&安培;搜索= MySearchTerm&安培;邮政编码= 12345&安培;国家= US
以下是产生上述内容的Linq:
var Items =
eBay.Items
.AddQueryOption("search", keywords)
.AddQueryOption("zipcode", searchParameters.Distance.ZipCode)
.AddQueryOption("country", "US")
.Where(x => x.Distance.Value <= searchParameters.Distance.SearchRadiusInMiles)
.Select(x => new EbayClassifiedAd
{
Title = x.Title,
Url = x.ViewItemUrl,
Price = x.CurrentPrice,
Source = "EBay"
}).ToList();