Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option not inferred for optional sproc parameters of type binary and nvarchar #377

Open
cmeeren opened this issue Mar 30, 2020 · 2 comments

Comments

@cmeeren
Copy link
Contributor

cmeeren commented Mar 30, 2020

Description

SqlClient does not infer the correct optionality for all stored procedure parameters.

For example, given this sproc with three optional parameters

CREATE PROCEDURE [dbo].[Procedure1]
  @param1 int = NULL,
  @param2 nvarchar(10) = NULL,
  @param3 binary(10) = NULL
AS
  SELECT 1

only the first one is inferred to be optional:

image

Note however that the type signature seems correct:

image

@smoothdeveloper
Copy link
Collaborator

@cmeeren this is tied to this:

let valueTypeWithNullDefault = typeInfo.IsValueType && defaultValue = Some(null)

Only value type are option wrapped, which I think makes sense.

You may pass null to work around your issue.

@cmeeren
Copy link
Contributor Author

cmeeren commented Mar 30, 2020

I see, I didn't notice that. Then at least I can use my sprocs :)

IMHO a uniform option interface for all optional params would make more sense, to clearly indicate that they are, in fact, optional - and also because in F#, we're usually using option for these arguments anyway, so this would save having to use Option.toObj. Feel free to close this issue if you don't agree. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants