用 OData Service 访问在线的 Northwind 数据库

728 篇文章 1 订阅
15 篇文章 0 订阅
用 OData Service 访问在线的 Northwind 数据库

// 编译命令
//"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\mscorlib.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  TypeProviderODataNorthwind.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;;

[<Generate>]
type Northwind = ODataService< "http://services.odata.org/Northwind/Northwind.svc/" >

let typeProviderOData02() = 
    let db = Northwind.GetDataContext()
    let q = query {
        for c in db.Customers do
        select c
        take 3
    }
    q |> Seq.iter ( fun n -> printfn "%s" n.ContactName)

typeProviderOData02()

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值