EF Core左连接内连接

内连接查两张表
from oo in query  
join comany in _companyRepository.GetAll() on oo.OfflineOrder.CompanyId equals comany.Id 
where comany.IsFamous 
select oo;

Lamad内连接
_storeRepository.GetAllIncluding().Join(_storeSupplierExtRepository.GetAllIncluding(), sr => sr.Id, sre => sre.StoreId, (sr, sre) => new { sr, sre }).FirstOrDefault(x => x.sr.StoreName == supplier.SupplierName);

左连接
from oo in query 
join mal in _exmailRepository.GetAll().Where(u => u.VipEndTime > DateTime.Now) on oo.OfflineOrder.CompanyId equals mal.CompanyId 
into malTemp 
from malJoin in malTemp.DefaultIfEmpty()

Lamad左连接
var query =_recommendStoreRepository.GetAll()
               .GroupJoin(_userRepository.GetAll()
               , rec => rec.RecommendUserId
               , user => user.Id
               , (rec, user) => new { rec, user = user.FirstOrDefault() })
               .WhereIf(input.OfflineOrderId > 0, m => m.rec.OfflineOrderId.Equals(input.OfflineOrderId))
               .ToListAsync();

 

EF Core左连接内连接

上一篇:Eureka是什么?


下一篇:线下化妆品零售店如何做私域获客?