Browse by Tags

02 December 2007
LINQ: Sequence contains no elements. InvalidOperationException when calling Single
If you call Single to get an object from your DB and the object doesn't exist you will get an InvalidOperationException. return this .DataContext.MemberDaos.Single(m => m.MemberID == id); Instead of Single, use SingleOrDefault, which will return null Read More...
8 Comments
Filed under: , ,
 
01 December 2007
LINQ: "Add" renamed to "InsertOnSubmit"
If you are using LINQ to insert data with RTM bits you won't find the Add method on the DataContext post Beta2. Use the InsertOnSubmit method instead. Read More...
6 Comments
Filed under: , ,
 
Page view tracker