关闭

用 OData 访问 EDR - Environmental Hazard Rank

515人阅读 评论(0) 收藏 举报

用 OData 访问  EDR - Environmental Hazard Rank

// 编译命令
//"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  TypeProviderEDR.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;;
open System;;


[<Generate>]
type EHR = Microsoft.FSharp.Data.TypeProviders.ODataService<"https://api.datamarket.azure.com/EDR/EnvironmentalHazardRank">


let EDR ()=
    let db = EHR.GetDataContext()
    // 还可以这样写
    // let db = EHR.ServiceTypes.EDREnvironmentalHazardRankContainer()
    db.Credentials <- NetworkCredential ("MSN帐号","主帐户密钥")

    let q = query {
        for e in db.EnvironmentalHazardRankingByUSPostalZipCode do
        where ( e.State = "WA")
        select e
    }

    q |> Seq.iter ( fun n -> printfn "%A - %A" n.ZipCode n.EnviromentalHazardIndex)

EDR()

0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:828275次
    • 积分:19745
    • 等级:
    • 排名:第451名
    • 原创:421篇
    • 转载:32篇
    • 译文:678篇
    • 评论:42条
    最新评论