我正在使用SqlCommandProvider,我需要为id集合中的每个id获取一些数据
let ids=["B058A99-C4B2-4CC3-BA9F-034B1F1ECCBD";"A09C01C-D51B-41C1-B44C-0995DD285088"]
[<Literal>]
let qLogo ="""SELECT Id,LogoUrl FROM Hotels WHERE Id IN (@IDS)"""
let queryLogo = new SqlCommandProvider<qLogo,constring>()
queryLogo .Execute(ids)//i need to be able to pass a collection here
Run Code Online (Sandbox Code Playgroud)
`
我有以下代码:
open FSharp.Data
[<Literal>]
let connectionString = @"Data Source=(local)\SQLExpress;Integrated Security=SSPI;Database=SfagStage"
type InsertEnhet = SqlCommandProvider<"Sql\InsertEnhet.sql", connectionString>
let insertEnhet (enhet:Enhet) =
let cmd = new InsertEnhet() // <<--- This generates an error runtime
cmd.Execute(enhet.Navn, enhet.Enhetsnummer, enhet.LEIKode, enhet.Kommune, DateTime.Now)
Run Code Online (Sandbox Code Playgroud)
我创建命令的行是导致我认为缺少方法的原因。我认为重要的例外部分是:
System.MissingMethodException: Method not found: 'Void FSharp.Data.ISqlCommand Implementation..ctor(FSharp.Data.Connection, Int32, System.String, Boolean, System.Data.SqlClient.SqlParameter[], FSharp.Data.ResultType, FSharp.Data.ResultRank, Microsoft.FSharp.Core.FSharpFunc`2, System.String)'.
Run Code Online (Sandbox Code Playgroud) f# type-providers f#-data assembly-binding-redirect fsharp.sqlclient