您的位置:首页 > 其它

用 OData Service 访问在线法律

2012-03-04 12:24 148 查看
用 OData Service 访问在线法律

// 编译命令
//"C:\Program Files\Microsoft SDKs\F#\3.0\Framework\v4.0\fsc.exe" --optimize- --tailcalls- --platform:x86 -r:"C:\Program Files\Reference Assemblies\Microsoft\FSharp\3.0\Runtime\v4.0\FSharp.Core.dll" -r:"E:\Projects\F#3\FSharp.Data.TypeProviders.dll"
-r:"C:\Program Files\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\Profile\Client\System.Core.dll" -r:"C:\Program Files\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\Profile\Client\System.Data.Services.Client.dll" -r:"C:\Program
Files\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\Profile\Client\System.dll" --noframework TypeProviderODataConsumerLegalArticles.fsx

#if INTERACTIVE
#r @"C:\Program Files\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Data.Services.Client.dll";;
#endif
open System.Data.Services.Client;;
#if INTERACTIVE
#r @"E:\Projects\F#3\FSharp.Data.TypeProviders.dll"
#endif
open Microsoft.FSharp.Data.TypeProviders;;

open System.Net;;

[<Generate>]
type Lawyers = ODataService< @"https://api.datamarket.azure.com/LexisNexis/ConsumerLegalArticles/" >

let LawyersDotCom() =
let articles = Lawyers.GetDataContext()
articles.Credentials <- NetworkCredential("MSN帐号","主帐户密钥")
let q = query {
for a in articles.Articles do
where (a.State = "Washington")
select a
}
q |> Seq.iter ( fun n -> printfn "%A" n.Title)

LawyersDotCom()

但是,我的帐号,好像不能访问。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: