Just a friendly reminder that I’m passing on from one of the tech reviewers of my book who (thankfully) noticed that I had left a note in there about Single & SingleOrDefault not being supported.
They were not in .NET 3.5 SP1 Entity Framework, but they are now supported in EF4.
Single is the way to go when you only expect one item to be in your result set.
As noted by many, the benefit of Single is highlighted in testing. Single expects only one item to be in the result set. If there are more, then an exception is thrown and this can help you discover logic errors in your application.
For a list of supported & unsupported LINQ methods used (or not used) in LINQ to ENtities, see the MSDN Topic: Supported and Unsupported LINQ Methods (LINQ to Entities)
Sign up for my newsletter so you don't miss my conference & Pluralsight course announcements!