danikf/tik4net

ExecuteSingleRowOrDefault Throws Exceptions

Deantwo opened this issue · 2 comments

Same issue as #74

public ITikReSentence ExecuteSingleRowOrDefault()

Hi, I am not sure what is the problem.

Expected behavior:
0 rows - returns null
1 rows - returns the row
more than 1 rows - throws exception
Mentioned in tests: https://github.com/danikf/tik4net/blob/master/tik4net.tests/TikCommandTest.cs#L239-L262

... which is the same behavior as with standard linq ...OrDefault methods (Linq throws InvalidOperationException in this case).
( new List<string>() {"test", "test2" }.SingleOrDefault() )

D

Oh yeah, i found that out when looking at #76.
Forgot to close this one again.

Maybe I was confusing it a little with .FirstOrDefault().