Skip to content

Commit

Permalink
Added AsEnumerable() which is typed as dynamic
Browse files Browse the repository at this point in the history
  • Loading branch information
7k8m committed Jul 21, 2020
1 parent 2af8299 commit 882575a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
9 changes: 9 additions & 0 deletions DirectSQL/SqlResult.cs
Expand Up @@ -122,6 +122,15 @@ public IEnumerable<TP> AsEnumerable<TP>(Func<dynamic,TP> convert)
return new Enumerable<TP>(this, convert);
}

/// <summary>
/// Return enumerable of SqlResult as dynamic
/// </summary>
/// <returns>Object which enumerate result of SqlResult</returns>
public IEnumerable<dynamic> AsEnumerable()
{
return new Enumerable<dynamic>(this, (obj => obj ));
}

/// <summary>
/// Result values as an array of tuples
/// </summary>
Expand Down
11 changes: 11 additions & 0 deletions TestSqlLiteDatabase/SqlResultTest.cs
Expand Up @@ -189,6 +189,17 @@ public void TestEnumerable()
).Sum();
Assert.AreEqual(123 * 2, sum2);
var sum3 =
(
from
dynamicObj in (result.AsEnumerable())
select
(int) dynamicObj.TEST_COL2
).Sum();
Assert.AreEqual(123 * 2, sum3);
});
});
}
Expand Down

0 comments on commit 882575a

Please sign in to comment.