我正在使用LINQ查询从表中搜索字符串,一段时间后导致超时异常。请帮助我简化如下查询。
var lstEntityMasterdata1 = (from E in _contextRegister.Entities
join ba in _contextRegister.BusinessActivities on E.MainActivityId equals ba.Id into NewBA
from BA in NewBA.DefaultIfEmpty()
where (E.NameOfEstablishment.Contains(SearchKey) || E.LicenseNr.Contains(SearchKey))
&& (E.IsDeleted != true && E.Active != false)
select new { E, BA }).ToList();