File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -46,7 +46,7 @@ local.properties
4646* .suo
4747* .user
4848* .sln.docstates
49-
49+ launchSettings.json
5050# Build results
5151
5252[Dd ]ebug /
Original file line number Diff line number Diff line change @@ -78,7 +78,10 @@ type DesignTime private() =
7878
7979 if t.IsArray
8080 then Expr.Value( Array.CreateInstance( t.GetElementType(), param.Size))
81- else Expr.Value( Activator.CreateInstance( t), t)
81+ elif t.IsPrimitive then
82+ Expr.Value( Activator.CreateInstance( t), t)
83+ else
84+ Expr.DefaultValue( t)
8285
8386 <@@ (%% Expr.Value( param.Name) : string), %% Expr.Coerce( value, typeof< obj>) @@>
8487 )
@@ -100,9 +103,10 @@ type DesignTime private() =
100103 if sqlParam.Direction.HasFlag( ParameterDirection.Output)
101104 then
102105 let mi =
103- typeof< Mapper>
104- .GetMethod( " SetRef" )
105- .MakeGenericMethod( sqlParam.TypeInfo.ClrType)
106+ ProvidedTypeBuilder.MakeGenericMethod(
107+ typeof< Mapper>
108+ .GetMethod( " SetRef" ),
109+ [ sqlParam.TypeInfo.ClrType])
106110 Expr.Call( mi, [ argExpr; Expr.Var arr; Expr.Value index ]) |> Some
107111 else
108112 None
Original file line number Diff line number Diff line change @@ -35,7 +35,11 @@ type Mapper private() =
3535 mapper values
3636
3737 static member SetRef < 't >( r : byref < 't >, arr : ( string * obj )[], i ) =
38- r <- arr.[ i] |> snd |> unbox
38+ let value = arr.[ i] |> snd
39+ r <-
40+ match value with
41+ | :? 't as v -> v
42+ | _ (* dbnull *) -> Unchecked.defaultof< 't>
3943
4044type Column = {
4145 Name: string
You can’t perform that action at this time.
0 commit comments