This question is locked. New answers and comments are not allowed.
Hi,
I have an issue using a .Where() statement containing a ternary.
Each path of the ternary return the evaluation to execute.
FluentModel.Accounts.Where(a =>a.AccountType == 1 ? a.Business == _idBusiness // for directs seller, check direct business: a.AccountType ==2 ? a.Customers.Any(c => c.Business == _idBusiness) // for indirect seller, check their client business: false);This generate an invalid statement, at least on sql serveur :
1....2.CASE WHEN a.[Business] = 23. THEN EXISTS(SELECT 1 FROM ....)4. ELSE5....The correct expression should be :
1....2.CASE WHEN a.[Business] = 23. THEN CASE WHEN EXISTS(SELECT 1 FROM ....)4. THEN 1 ELSE 0 END5. ELSE6....
I'm using the 2015.1 version of openaccess
Regards,