2

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?

ShawnMartin
  • 282
  • 2
  • 7
  • [Your use of `TestDb` should be either for Sql Server function, stored procedure, or table, not just *anything*](http://fsprojects.github.io/FSharp.Data.SqlClient/) – Gene Belitski Aug 03 '15 at 15:35

1 Answers1

2

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

Gene Belitski
  • 10,270
  • 1
  • 34
  • 54
  • 1
    I think you've pointed me in the right direction. I was looking at [link](http://fsprojects.github.io/FSharp.Data.SqlClient/configuration%20and%20input.html) which is maybe out of date? Also I had to do a clean project before even the correct syntax would work. – ShawnMartin Aug 03 '15 at 16:17