I tried to use Except method. I thought this method was more powerfull and generates a cleaner SQL than a WHERE clause but not. It generates the same sql.
So why / when use Except method ?
EDIT : here is a sample :
// Get customers except those which ID are in the LostCustomers table
TblCustomers.Except(TblCustomers.Where(tj => LostCustomers.Select(lj => lj.CustomerId).Contains(tj.CustomerID))).Select(j => new
{
CustomerId = j.CustomerID,
CustomerRef = j.CustomerRef,
CustomerName = j.Name
})
// Get customers except those which ID are in the LostCustomers table
TblCustomers.Where(tj => !LostCustomers.Select(lj => lj.CustomerId).Contains(tj.CustomerID)).Select(j => new
{
CustomerId = j.CustomerID,
CustomerRef = j.CustomerRef,
CustomerName = j.Name
})
Thx