ShawnMartin
ShawnMartin

Reputation: 282

Troubleshoot the SqlProgrammabilityProvider

I can't seem to get the SqlProgrammabilityProvider to work even in the most basic configuration. With this code

type TestDb = SqlProgrammabilityProvider<testConn>
let db = TestDb()

I get the design/compile-time error "The value or constructor 'TestDb' is not defined"

testConn is a literal string that is working fine with the SqlCommandProvider in the same project.

I'm using VS 2015, FSharp.Data.SqlClient 1.7.5, and I've tried targeting .NET 4.5.2 and 4.6.

Are there known issues or limitations with this? If not, how could I troubleshoot it?

Upvotes: 2

Views: 595

Answers (1)

Gene Belitski
Gene Belitski

Reputation: 10350

After getting a type for SqlProgrammabilityProvider upon a specific connection you should tie it to as many as you like, but of the concrete following options: Sql Server function, stored procedure, or table.

Like in:

type TestDb = SqlProgrammabilityProvider<testConn>
type Datatable = TestDb.dbo.Tables.MyDataTable

or

use cmd = TestDB.dbo.MyStoredProcedure()
cmd.Execute(Param1="xyzzy")

You may peek at use cases at https://github.com/fsprojects/FSharp.Data.SqlClient/tree/master/src/SqlClient.Tests

Upvotes: 2

Related Questions