How to connect to SQL Server Compact Edition 4.0 with a type provider in F#?

我与影子孤独终老i 提交于 2019-12-04 06:12:44

This "Works on my Machine" (using VS 11 beta, Entity Framework, based on the walkthrough here, http://msdn.microsoft.com/en-us/library/hh361038(v=vs.110).aspx :

open System.Data.Linq
open System.Data.EntityClient
open Microsoft.FSharp.Data.TypeProviders

let connectionString = "metadata=res://*/;provider=System.Data.SqlServerCe.4.0;provider connection string='data source=C:\\Data\\SQLCE\\Test\\nw40.sdf';"

type internal edmx = EdmxFile<"NWModel.edmx", ResolutionFolder = @"C:\Users\erik.COMMENTOR\Documents\Visual Studio 11\Projects\TestSqlCeFSharp">

let internal context = new edmx.nw40Model.nw40Entities(connectionString)

query { for supplier in context.Suppliers do
        select supplier }
|> Seq.iter (fun supplier -> printfn "%s" supplier.Company_Name)

Added references to: FSharp.Data.TypeProviders, System.Data.Entity, System.Data.Linq

Supported info of 'System.Data.SqlServerCe.4.0' in  Microsoft.FSharp.Data.TypeProviders
1.SqlDataConnection is not
2.DbmlFile is partial
    type dbml = DbmlFile<_>
    use cn = new SqlCeConnection(...)
    use db = new dbml.DbContext(cn)
3.EdmxFile is full
4.SqlEntityConnection is full
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!