Can anyone help me understand why the piece of code below returns no results from the query yet the second sample does (though woe betide me if I try to use criteria on the second one!)
type EbayData =
ODataService<"http://ebayodata.cloudapp.net">
let Ebay = EbayData.GetDataContext()
let Favourites title number = query{
for deal in Ebay.Deals do
where (deal.Title.Contains(title))
take number
}
let Esearch title number = [for item in Favourites title number do
yield item]
The working version:
type Catalog = ODataService< "http://ebayodata.cloudapp.net/" >
let ebay = Catalog.GetDataContext()
let trial =
[ for item in ebay.Deals do
yield item]
I can’t seem to output the first to any kind of list, no matter what do with |> etc. The second sample doesn’t seem to bring back many resuls to do a text query on. However, my real issue is I can’t seem to get anything out of the LINQ in F# version.
The output is used in a WPF application where I use VB to talk to the list. I have populated a non discriminated list of 10 items with it, so that end does work. This is the VB code.
For Each Deal In trial.Where(Function(p) p.Title.Contains(title.Text))
DealResults.Items.Add(buildStackPanel(Deal))
Next
The spacing for the F Sharp on this post doesn’t seem to work when I hit Ctrl-K so if anyone can tell me what I’m doing wrong – I guess that’s a second question!
I don’t know why this is not working for you. I knocked out the following and it seems to work:
Maybe you tried searching for stuff that doesn’t exist? At the moment there are only 6 deals, so this is not unlikely.
Querying Items
Read about the eBay OData service here: http://ebayodata.cloudapp.net/docs
It has special needs when querying for Items:
So to query Items, you’ll need to provide at least a search phrase. Your
wherestatement doesn’t get translated to a search parameter in the final url. To add custom parameters in this Type Provider, you do .AddQueryOption.