Skip to content

Commit 0dba9c1

Browse files
properly resolve now exposed statement parameter types
* Shared.fs adding lookup through UDDT columns definition (array lookup for now, may move to a readonly dictionary) * DesignTime.fs pass the units of measure lookup (not 100% clear why it is not just passed everywhere yet)
1 parent 2161eda commit 0dba9c1

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

‎src/SqlClient.DesignTime/DesignTime.fs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ type DesignTime private() =
357357

358358
let providedType =
359359
match outputColumns with
360-
| [ x ] -> x.GetProvidedType()
360+
| [ x ] -> x.GetProvidedType(?unitsOfMeasurePerSchema = unitsOfMeasurePerSchema)
361361
| xs -> Microsoft.FSharp.Reflection.FSharpType.MakeTupleType [| for x in xs -> x.GetProvidedType(?unitsOfMeasurePerSchema = unitsOfMeasurePerSchema) |]
362362

363363
let clrTypeName = erasedToTupleType.FullName

‎src/SqlClient/Shared.fs‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,12 @@ type [<DataContract;CLIMutable>] Column = {
8686
assert(unitsOfMeasurePerSchema.IsSome)
8787
let uomType = unitsOfMeasurePerSchema.Value.[this.TypeInfo.Schema] |> List.find (fun x -> x.Name = this.TypeInfo.UnitOfMeasureName)
8888
ProviderImplementation.ProvidedTypes.ProvidedMeasureBuilder.AnnotateType(this.TypeInfo.ClrType, [ uomType ])
89+
elif isNull this.TypeInfo.ClrType && this.TypeInfo.TableTypeColumns.Length > 0 then
90+
// we need to lookup matching uddt column to resolve the type
91+
let matchingUddtColumn = this.TypeInfo.TableTypeColumns |> Array.find (fun t -> t.Name = this.Name)
92+
matchingUddtColumn.TypeInfo.ClrType
8993
else
94+
// normal parameter case
9095
this.TypeInfo.ClrType
9196

9297
if this.Nullable

0 commit comments

Comments
 (0)