How to avoid "source !=null" when using Code Contracts and Linq To Sql?
- by Florian
I have the following code using a normal data context which works great:
var dc = new myDataContext();
Contract.Assume(dc.Cars!= null);
var cars = (from c in dc.Cars
where c.Owner = 'Jim'
select c).ToList();
However when I convert the filter to an extension method like this:
var dc = new myDataContext();…