hirisw

博客园 首页 联系 订阅 管理

2012年5月13日

摘要: linq to sql生成not in语句的小技巧以前一直觉得linq to sql生成类似where id not in (1,3,5)或where id not in (select id from ...)这样的条件不是很方便,每次我都是把条件ID事先取到一个数组里,然后用 !Arr.Contains(c.Id)这样处理,今天突然发现这样好傻,其实可以完全直接用linq写成一句,贴个示例在这里,以后备查froma in TableA where !(fromb in TableB Where ... select b.Id).Contains(a.Id)最终翻译出来的语句并非跟not i 阅读全文
posted @ 2012-05-13 02:06 hirisw 阅读(135) 评论(0) 推荐(0) 编辑