Why, when I create the SqlClient type, do I get the missing method exception execution time?

I have the following code:

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)

The line in which I create the command is what invokes the missing method that I think. This part of the exception that I think of is relevant:

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)'.
+4
source share
1 answer

This is an exception that you can get if you do not have the right one bindingRedirectfor FSharp.Core.dll. Check out this article by Mark Semann . Basically, I think adding app.configc bindingRedirectto your application should solve the problem.

, FSharp.Core , FSharp.Core. .NET FSharp.Core, , (, FSharpFunc) - MethodMissing, .NET FSharpFunc - , . ( .)

+4

Source: https://habr.com/ru/post/1611449/


All Articles