Created
September 17, 2011 03:25
-
-
Save dmohl/1223596 to your computer and use it in GitHub Desktop.
F# StackOverflow OData Type Provider Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#r "FSharp.Data.TypeProviders" | |
#r "System.Data.Services.Client" | |
open Microsoft.FSharp.Data.TypeProviders | |
[<Generate>] // Only needed for the Developer Preview (this will be dropped before the official release of F# 3.0) | |
type stackoverflow = | |
ODataService<ServiceUri = @"http://data.stackexchange.com/stackoverflow/atom"> | |
let dataContext = stackoverflow.GetDataContext() | |
query { | |
for post in dataContext.Posts do | |
where (post.Tags.Contains "fsharp") | |
count | |
} |> printfn "There are %i posts marked with the fsharp tag on SO" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment