linq下 多条件 on后面多条件 左连接
来源:互联网 发布:20142015cba总决赛数据 编辑:程序博客网 时间:2024/05/16 18:50
linq下 多条件 on后面多条件
1、左连接的实现主要是基于 join 后加 into 变量1
from 变量 in 变量1.DefaultIfEmpty()
2、这里还有一个多条件的例子:
new{ColorCode=productColor.ColorCode,PTCode="ProductColors" } equals new {ColorCode=parameter.PValue,PTCode=parameter.PTCode}
匿名类里放多个值equals 来实现多条件联合查询
下面是多个表联合左查询 多条件实例
var queryMatial = from palnOrder in _substationPlanOrderItemRepository.Entities join productInfo in _productInfoRepository.Entities on palnOrder.ProductCode equals productInfo.ProductCode into left1 from productInfo in left1.DefaultIfEmpty() join brandInfo in _brandInfoRepository.Entities on productInfo.BrandCode equals brandInfo.BrandCode into left2 from brandInfo in left2.DefaultIfEmpty() join productColor in _productColorRepository.Entities on productInfo.ProductCode equals productColor.ProductCode into left3 from productColor in left3.DefaultIfEmpty() join parameter in _parameterRepository.Entities on new{ColorCode=productColor.ColorCode,PTCode="ProductColors" } equals new {ColorCode=parameter.PValue,PTCode=parameter.PTCode} into left4 from parameter in left4.DefaultIfEmpty() join productCata in _productCategoryRepository.Entities on productInfo.CategoryCodeMain equals productCata.CategoryCode into left5 from productCata in left5.DefaultIfEmpty() // where parameter.PTCode == "ProductColors" select new orderMatialEntity { ProductId = productInfo.ProductId, ProductCode = productInfo.ProductCode, ProductName = productInfo.ProductName, BrandCode = productInfo.BrandCode, BrandName = brandInfo.BrandName, Model = productInfo.Model, Specifications = productInfo.Specifications, Material = productInfo.Material, Color = parameter.PValue, Qnty = palnOrder.Qnty.Value, Remark = palnOrder.Remark, ProductStatus = palnOrder.ProductStatus, PurchaseCode = palnOrder.PurchaseCode, MainCatalogCode = productCata.CategoryCode, MainCatalogName = productCata.CategoryName };
自己记录下 请大神指导优化或者同行斧正!
1 0
- linq下 多条件 on后面多条件 左连接
- LINQ实现左连接及多条件连接方法
- linq中怎么实现多条件关联的左连接???
- linq join on 多条件
- linq join on 多条件
- 左外连接 where条件 on条件
- 左连接中on 后面的条件与wher…
- Linq查询(多条件join on查询)
- Linq的join后面跟多个条件
- Linq多条件查询
- LINQ多条件查询
- msyql left join on 后面多个条件
- msyql left join on 后面多个条件
- 连接查询,条件在on和where后面的区别
- LINQ 多条件查询 where 条件组建
- 浅谈左连接 on和where条件的区别
- MySQL左外连接where条件包含多表写法
- linq join两个表连接的多个条件使用
- 用ORL人脸数据库和opencv的facererc_demo.cpp做人脸检测
- 第一章 数据结构和算法 (1)
- EJB到底是什么,真的那么神秘吗??简简单单解释清楚。就这么直白,终于明白了
- srping 基于maven的打包配置(jar)
- C++引用和指针简单样例对比
- linq下 多条件 on后面多条件 左连接
- bzoj 3172 [Tjoi2013]单词 后缀自动机
- 基于Retrofit+Okio+RxBus实现文件下载(带下载进度)
- YUV主要采样格式理解
- google Inception v1 - v4 papers 发展历程
- UITableView可编辑状态常用操作
- 蜀山群英战记隐私政策
- Android系统属性SystemProperty分析
- 深度学习:CS231n官方笔记