score:2

Accepted answer

It depends. DbSet.SingleOrDefault(<condition>).Attribute will fetch whole row from database and pass it over the network to you application. So if your table has many columns and/or columns containing a lot of data (big stings, some binary data) then first one should be faster cause it will fetch only data which is actually needed.

Also note that SingleOrDefault can return null, so without null check you can get NullReferenceException.


Related Articles