fsprojects / fsprojects/FSharp.Data.SqlClient

Add AllParametersOption as safer alternative to AllParametersOptional

Open
#327 10 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

improvement up-for-grabs
Dominant language
F#
Stars
206
Forks
66
PR merge metrics
No merged PRs in 30d

Description

Using AllParametersOptional is more dangerous than it needs to be. Since it makes all parameters optional, you get no compile-time check when you add new parameters to your SQL and forget to add them to Execute/AsyncExecute.

A safer alternative would be to make the parameters option-wrapped instead of implementing them as optional parameters. That way, all parameters would still be mandatory, and you'll get a compiler error if you add new params to your SQL without adding them to Execute/AsyncExecute.

I therefore suggest adding a new option AllParameterOption (in addition to the existing AllParametersOptional), so that users can choose a safer alternative if they want.

(Feel free to choose a better name for the static parameter, of course.)

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 by tracing the existing AllParametersOptional option and its Execute and AsyncExecute entry points. Determine how parameter generation and SQL validation are implemented, then define the new option so parameters are option-wrapped while remaining mandatory. Done means the safer alternative is available alongside AllParametersOptional and enforces missing parameters at compile time.

Written by the indexing model from the issue text.

Assessment

Tech stack
fsharp, sql
Domain
databases
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.