Issue Summary
When using a user defined table type with a fixed length binary column the wrong constructor for SqlMetaData is used resulting in the following exception.
System.ArgumentException: 'The dbType Binary is invalid for this constructor.'
This line looks like it's causing the issue, which incorrectly assumes if it is a fixed length that it can safely use the two parameter constructor:
|
if typeInfo.IsFixedLength then |
To Reproduce
- Create a custom table type
CREATE TYPE [dbo].[CustomTableType] AS TABLE(
[Value] [binary](16)
)
- Use the type in a query
type StaticProvider =
SqlCommandProvider<"
Declare @Updates as CustomTableType = @Inputs;
" , staticConnectionString>
use cmd = new StaticProvider(context.connection, transaction = context.transaction)
cmd.AsyncExecute(
data.inputs
|> List.map(fun x ->
StaticProvider.CustomTableType( // <--- Error in constructor
Value = x.value
)
)
Error
System.ArgumentException: 'The dbType Binary is invalid for this constructor.'
Expected behavior
There should not be an error in this case.
What you can do
Issue Summary
When using a user defined table type with a fixed length binary column the wrong constructor for
SqlMetaDatais used resulting in the following exception.This line looks like it's causing the issue, which incorrectly assumes if it is a fixed length that it can safely use the two parameter constructor:
FSharp.Data.SqlClient/src/SqlClient.DesignTime/DesignTime.fs
Line 544 in 0bc5129
To Reproduce
Error
Expected behavior
There should not be an error in this case.
What you can do