Skip to content

Commit abbf31d

Browse files
revert reflection
1 parent 18e02e6 commit abbf31d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/SqlClient/ISqlCommand.fs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -185,10 +185,10 @@ type ``ISqlCommand Implementation``(cfg: DesignTimeConfig, connection: Connectio
185185
| _ ->
186186
match p.SqlDbType with
187187
| SqlDbType.Structured ->
188-
p.Value <-
189-
match value |> unbox |> Seq.cast<Microsoft.SqlServer.Server.SqlDataRecord> with
190-
| records when Seq.isEmpty records -> null
191-
| records -> records
188+
//done via reflection because not implemented on Mono
189+
let sqlDataRecordType = typeof<SqlCommand>.Assembly.GetType("Microsoft.SqlServer.Server.SqlDataRecord", throwOnError = true)
190+
let records = typeof<Linq.Enumerable>.GetMethod("Cast").MakeGenericMethod(sqlDataRecordType).Invoke(null, [| value |]) :?> seq<Microsoft.SqlServer.Server.SqlDataRecord>
191+
p.Value <- if Seq.isEmpty records then null else records
192192
| _ -> p.Value <- value
193193

194194
elif p.Direction.HasFlag(ParameterDirection.Output) && value :? Array then

0 commit comments

Comments
 (0)