How to solve error Sequence contain more than one element?

By aj li

Single() or FirstOrDefault()

I have this code:

select new PartsInvoiceItemData
{
Id = pii.Id,
Model =
(
<Query here>
).Single(),

Error: Sequence contain more than one element.

Solution: Change Single() to FirstOrDefaut() because the query returns more than one results

How to solve error Sequence contain more than one element?  (874 Views)