-
Notifications
You must be signed in to change notification settings - Fork 68
Open
Description
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
- I am willing to contribute a PR with a unit test showcasing the issue
- I am willing to test the bug fix before next release
Metadata
Metadata
Assignees
Labels
No labels