Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

When returning data from a Query, convert DBNull values to null so ca…

…n use ?? operator
  • Loading branch information...
commit 007d2006459e76c4fc073d794b6d9c690141e8a1 1 parent 976ca19
David Clarke authored
Showing with 2 additions and 2 deletions.
  1. +2 −2 Massive.cs
View
4 Massive.cs
@@ -55,8 +55,8 @@ public static class ObjectExtensions {
public static dynamic RecordToExpando(this IDataReader rdr) {
dynamic e = new ExpandoObject();
var d = e as IDictionary<string, object>;
- for (int i = 0; i < rdr.FieldCount; i++)
- d.Add(rdr.GetName(i), rdr[i]);
+ for (int i = 0; i < rdr.FieldCount; i++)
+ d.Add(rdr.GetName(i), DBNull.Value.Equals(rdr[i]) ? null : rdr[i]);
return e;
}
/// <summary>
Please sign in to comment.
Something went wrong with that request. Please try again.