Linq to Sql 左串連查詢

來源:互聯網
上載者:User

標籤:block   upn   cte   sel   ext   ges   log   技術分享   ror   

 1 var query = from t0 in context.ExpressSendMaster 2 join t1 in context.Supplier on t0.SupplierCode equals t1.SupplierCode 3 join t2 in context.ExpressSendPackageRule on t0.AreaId equals t2.Id into t0_join 4 from t0_t2 in t0_join.DefaultIfEmpty() 5 where t0.Id == MasterId 6 select new ExpressPackageOffLineModel 7 { 8 PackWeight = t0.Weight, 9 SupplierCode = t1.SupplierCode,10 SupplierName = t1.Name,11 SendDate = t0.SendDate,12 OneselfNumber = t0.OneselfNumber,13 Memo = t0.Memo,14 GroupCheck = t0.AreaCode,15 GroupName = t0_t2.NumberType == null ? "" : t0_t2.NumberType,16 GroupId = t0_t2.Id == null ? 0 : t0_t2.Id,17 LimitWeight = t0_t2.LimitWeight == null ? 0 : t0_t2.LimitWeight18 };19 20 21 if (query.Count() <= 0)22 {23 model.HasError = true;24 model.ErrorMessage = "錯誤提示";25 return false;26 }27 28 model.PackWeight = query.First().PackWeight;29 model.SupplierCode = query.First().SupplierCode;30 model.SupplierName = query.First().SupplierName;31 model.SendDate = query.First().SendDate;32 model.OneselfNumber = query.First().OneselfNumber;33 model.GroupName = query.First().GroupName;34 model.Memo = query.First().Memo;35 model.GroupCheck = query.First().GroupCheck;36 model.GroupId = query.First().GroupId;37 model.LimitWeight = query.First().LimitWeight;
View Code

 

 

Linq to Sql 左串連查詢

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.