fsprojects / fsprojects/FSharp.Data.SqlClient

SqlProgrammabilityProvider - can't specify connection at runtime for Tables

Open
#210 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

docs
Dominant language
F#
Stars
206
Forks
66
PR merge metrics
No merged PRs in 30d

Description

Description

When instantiating a stored procedure via SqlProgrammabilityProvider, or anything created by SqlCommandProvider, constructors are provided that accept a connection string or an SqlConnection object so that the DB may be specified at runtime. No constructor is provided for table access.

Existing behavior for SqlCommandProvider
type lookup = SqlCommandProvider<"select * from mobile_onboard_tokens", DEV_CONN_STR>
let commandResult = 
    use sproc = new lookup(productionConnStr)
    sproc.Execute()
Existing behavior for SqlProgrammabilityProvider (stored procedures)
type DB = SqlProgrammabilityProvider<DEV_CONN_STR>
let sprocResult =
    use sproc = new DB.dbo.te_mobile_onboard_tokens_INS(productionConnStr)
    sproc.Execute("token", clientID)
Existing behavior for SqlProgrammabilityProvider (tables)
let tableResult =
    use table = new DB.dbo.Tables.mobile_onboard_tokens()
    table.AddRow("token", clientID)
Desired behavior for SqlProgrammabilityProvider (tables)
let tableResult =
    use table = new DB.dbo.Tables.mobile_onboard_tokens(**productionConnStr**)
    table.AddRow("token", clientID)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with SqlProgrammabilityProvider table access and compare the generated table constructor with the stored-procedure and SqlCommandProvider examples. Verify the mobile_onboard_tokens/AddRow scenario using productionConnStr; done means table instances accept the runtime connection while preserving existing table operations.

Written by the indexing model from the issue text.

Assessment

Tech stack
fsharp, sql
Domain
database
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.