Skip to content

Commit d903ca2

Browse files
committed
Handle null/DBNull.Value in CommandBatch so ParameterTransform can be simpler.
1 parent b14e33e commit d903ca2

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/Rezoom.SQL.Mapping/CommandBatch.fs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ type private CommandBatchBuilder(conn : DbConnection, tran : DbTransaction) =
2727

2828
let addCommand (builder : StringBuilder) (dbCommand : DbCommand) (commandIndex : int) (command : Command) =
2929
let parameterOffset = dbCommand.Parameters.Count
30-
let addParam name dbType value =
30+
let addParam name dbType (value : obj) =
3131
let dbParam = dbCommand.CreateParameter()
3232
dbParam.ParameterName <- name
3333
dbParam.DbType <- dbType
34-
dbParam.Value <- value
34+
dbParam.Value <- if isNull value then box DBNull.Value else value
3535
ignore <| dbCommand.Parameters.Add(dbParam)
3636
for i, parameter in command.Parameters |> Seq.indexed do
3737
match parameter with

0 commit comments

Comments
 (0)