Skip to content

Commit e830acd

Browse files
Merge pull request #1 from smoothdeveloper/fix-exn-on-empty-table-value-argument
Fix exn on empty table value argument
2 parents 2d7893b + 652a014 commit e830acd

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/SqlClient.Tests/TVPTests.fs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,13 @@ let SprocTupleValue() =
7272
let actual = cmd.Execute(p).Value
7373
Assert.Equal((1, Some "monkey"), actual)
7474

75+
[<Fact>]
76+
let ``SprocTupleValue works with empty table``() =
77+
let cmd = new TableValuedSprocTuple()
78+
let p = []
79+
let actual = cmd.Execute(p)
80+
Assert.Equal(None, actual)
81+
7582
type TableValuedTupleWithOptionalParams = SqlCommandProvider<"exec Person.myProc @x", ConnectionStrings.AdventureWorksNamed, AllParametersOptional = true>
7683
[<Fact>]
7784
let TableValuedTupleWithOptionalParams() =

src/SqlClient/ISqlCommand.fs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,9 +177,10 @@ type ``ISqlCommand Implementation``(cfg: DesignTimeConfig, connection: Connectio
177177

178178
if p.Direction.HasFlag(ParameterDirection.Input)
179179
then
180-
if isNull value then
180+
match value with
181+
| null ->
181182
p.Value <- DBNull.Value
182-
else
183+
| _ ->
183184
match p.SqlDbType with
184185
| SqlDbType.Structured ->
185186
p.Value <-

0 commit comments

Comments
 (0)