用 OData 访问 Utility Rate Service

用 OData 访问 Utility Rate 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  TypeProviderUtilityRateService.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 TU = Microsoft.FSharp.Data.TypeProviders.ODataService<"https://api.datamarket.azure.com/Microsoft/UtilityRateService/">

let MSU() =
    //let db = TU.GetDataContext()
    let db = TU.ServiceTypes.MicrosoftUtilityRateServiceContainer()
    db.Credentials <- NetworkCredential ("hadstj@hotmail.com","kokyWfYXaG5H63g3CvS3UW5mgnydQFvwXyc1h+p7U+I=")
    //    db.Credentials <- NetworkCredential ("MSN帐号","主帐户密钥")

    let q = query {
        for u in db.UtilityByPostalCodes do
        where (u.PostalCode = "98052")
        select u
    }

    q |> Seq.iter(fun n -> printfn "%A - %A" n.Name n.RateSource )

MSU()

阅读更多
版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/hadstj/article/details/7396296
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

不良信息举报

用 OData 访问 Utility Rate Service

最多只允许输入30个字

加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!
关闭
关闭