Dapper - QuerySingle
The result can be mapped to:
First, Single & Default
Be careful to use the right method. First & Single methods are very different.
Result | No Item | One Item | Many Items |
---|---|---|---|
First | Exception | Item | First Item |
Single | Exception | Item | Exception |
FirstOrDefault | Default | Item | First Item |
SingleOrDefault | Default | Item | Exception |
Try it: | .NET Framework
{
Try it: | .NET Framework