Tip: Use the LINQ methods that take a predicate

2010-02-03 09:33:09 +0000

Instead of this:

var author = (from a in dataContext.Authors where a.Id == authorId select a).Single();

…use this:

var author = dataContext.Authors.Single(a => a.Id == authorId);

Also consider whether you wanted SingleOrDefault.