Commit 3691fe13 authored by Marc Gravell's avatar Marc Gravell

allow null arrays on suitable RDBMS

parent bff05e72
...@@ -2394,20 +2394,17 @@ public static void PackListParameters(IDbCommand command, string namePrefix, obj ...@@ -2394,20 +2394,17 @@ public static void PackListParameters(IDbCommand command, string namePrefix, obj
// initially we tried TVP, however it performs quite poorly. // initially we tried TVP, however it performs quite poorly.
// keep in mind SQL support up to 2000 params easily in sp_executesql, needing more is rare // keep in mind SQL support up to 2000 params easily in sp_executesql, needing more is rare
var list = value as IEnumerable;
var count = 0;
if (list != null)
{
if (FeatureSupport.Get(command.Connection).Arrays) if (FeatureSupport.Get(command.Connection).Arrays)
{ {
var arrayParm = command.CreateParameter(); var arrayParm = command.CreateParameter();
arrayParm.Value = list; arrayParm.Value = value ?? DBNull.Value;
arrayParm.ParameterName = namePrefix; arrayParm.ParameterName = namePrefix;
command.Parameters.Add(arrayParm); command.Parameters.Add(arrayParm);
} }
else else
{ {
var list = value as IEnumerable;
var count = 0;
bool isString = value is IEnumerable<string>; bool isString = value is IEnumerable<string>;
bool isDbString = value is IEnumerable<DbString>; bool isDbString = value is IEnumerable<DbString>;
foreach (var item in list) foreach (var item in list)
...@@ -2485,7 +2482,6 @@ public static void PackListParameters(IDbCommand command, string namePrefix, obj ...@@ -2485,7 +2482,6 @@ public static void PackListParameters(IDbCommand command, string namePrefix, obj
}); });
} }
} }
}
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment