I have the following models with nav settings set in the Entity Framework Core:
- CRMLocations (one-to-many) CRMPities
- CRMeoples (one to many) CRMEmails
- CRMPeoples (one to many) CRMPhones
I have the following working request:
var iqable = _crmDbContext.CRMPeoples .Where(p => p.Name.ToLower().Contains(query) || (from e in p.CRMEmails where e.EmailAddress.ToLower().Contains(query) select e).Any() || (from h in p.CRMPhones where h.PhoneNumberNormalized.Contains(query) select h).Any()) .Select(p => new CRMSearchResultDTO() { PersonName = p.Name, LocationName = p.CRMLocations.Name, });
How to replace the expression "(from in where select) .Any ()" to use the Linq lambda syntax? Must result in 1 SQL statement. Can use left stitch connection or nested selection.
c # linq linq-to-sql entity-framework-core
ttugates Dec 18 '17 at 14:29 2017-12-18 14:29
source share