惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

量子位
Vercel News
Vercel News
Google DeepMind News
Google DeepMind News
罗磊的独立博客
WordPress大学
WordPress大学
The Cloudflare Blog
GbyAI
GbyAI
The Register - Security
The Register - Security
L
LangChain Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
Microsoft Security Blog
Microsoft Security Blog
MyScale Blog
MyScale Blog
A
About on SuperTechFans
U
Unit 42
T
The Blog of Author Tim Ferriss
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
V
Visual Studio Blog
云风的 BLOG
云风的 BLOG
Stack Overflow Blog
Stack Overflow Blog
博客园 - 三生石上(FineUI控件)
博客园 - 司徒正美
Blog — PlanetScale
Blog — PlanetScale
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
M
MIT News - Artificial intelligence
C
CERT Recently Published Vulnerability Notes
T
The Exploit Database - CXSecurity.com
T
Tor Project blog
A
Arctic Wolf
H
Hacker News: Front Page
NISL@THU
NISL@THU
F
Full Disclosure
雷峰网
雷峰网
L
LINUX DO - 热门话题
Recent Announcements
Recent Announcements
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Apple Machine Learning Research
Apple Machine Learning Research
Google Online Security Blog
Google Online Security Blog
I
InfoQ
Webroot Blog
Webroot Blog
S
Security Affairs
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
爱范儿
爱范儿
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
N
News | PayPal Newsroom
Forbes - Security
Forbes - Security
博客园 - Franky
V
Vulnerabilities – Threatpost
博客园 - 【当耐特】
Latest news
Latest news

博客园 - 阿修罗一平

IIS部署WCF出现的各种问题汇总 Infragistics控件的工具栏注册 NUnit的使用中可能遇到的问题 Nihibernate的重要知识点 Devexpress使用记录 使用List数据集合,利用DevExpress.XtraReports开发Master-Detail报表 PDA访问WCF PDA(WinCE)项目开发中遇到的问题及解决方法总结 Grid控件绑定bindingSource后在新增行时设置Cell的初始值 “BindingSource绑定单个实体对象后在代码中赋值无效和无法显示”的解决方法 sqlservier2005转成sqlserver2000中出现的问题(WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]) 项目考虑因素及解决方案(.net) 设计模式在工作中的应用(三) 设计模式在工作中的应用(二) 设计模式在工作中的应用(一) NHibernate示例 Remoting服务集成到IIS的简单总结 关于Remoting服务启动和停止的简单总结 将公司系统从SqlServer 2K移植到Oracle 10g中的简要总结
Linq备忘
阿修罗一平 · 2011-02-21 · via 博客园 - 阿修罗一平

有些用法老是记不住,现在记录在网上,下次就容易查到了,不必到处搜索了。

1、Groupby

var tempPlanGoodsItems =
                (from p in m_StockInPlan.GoodsItems
                group p by new { p.GoodsName, p.MaterialNo, p.CompanySerialNo, p.SpecAndModel, p.BatchNo, p.SkuNo } into g
                select new RestGoodsItem
                {
                    GoodsName = g.Key.GoodsName,
                    MaterialNo = g.Key.MaterialNo,
                    CompanySerialNo = g.Key.CompanySerialNo,
                    SpecAndModel = g.Key.SpecAndModel,
                    BatchNo = g.Key.BatchNo,
                    SkuNo = g.Key.SkuNo,
                    PlanQuantity = g.Sum<PlanGoodsItem>(p => p.Quantity),
                    Quantity = 0,

                }).ToList<RestGoodsItem>();

2、主子表查询(子表条件)

 IList<StockOutPlan> stockOutPlans = m_StockOutPlanBizService.CreateQueryNoNoLazies("select distinct p from StockOutPlan as p inner join p.GoodsItems as g where g.StockInPlanNo='" + m_StockInPlan.PlanNo + "'", new List<string> { StockOutPlan.NON_LAZY_GOODSITEMS});