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

推荐订阅源

G
Google Developers Blog
Google DeepMind News
Google DeepMind News
Microsoft Security Blog
Microsoft Security Blog
Martin Fowler
Martin Fowler
MyScale Blog
MyScale Blog
The GitHub Blog
The GitHub Blog
I
InfoQ
A
About on SuperTechFans
GbyAI
GbyAI
宝玉的分享
宝玉的分享
爱范儿
爱范儿
博客园 - 【当耐特】
博客园 - 司徒正美
博客园 - 聂微东
P
Proofpoint News Feed
WordPress大学
WordPress大学
云风的 BLOG
云风的 BLOG
Last Week in AI
Last Week in AI
阮一峰的网络日志
阮一峰的网络日志
B
Blog RSS Feed
Jina AI
Jina AI
aimingoo的专栏
aimingoo的专栏
J
Java Code Geeks
博客园 - 叶小钗

博客园 - J-Pei

entity framework ConnectionString include password Microsoft Visual Studio无法启动程序进行调试的解决方法 通过Process调用桌面程序 深入理解Javascript闭包(closure) 安装SQL Server 2005过程出现错误:“SQL Server 服务无法启动”的解决办法 动态修改div的xy值 asp.net mvc 与jquery应用总结 Ajax 选项 这才是真正的JQuery.ajax传递中文参数的解决方法 ASP.NET MVC生命周期介绍(转) ASP.NET页生命周期介绍:阶段,事件及其他(转) JQuery 实现网页的快捷键操作 IE8下json.js 中文编码问题 Meet Chirpy sybase性能调优 Entity FrameWork 4.1 RC 生成的sql语法性能存在问题 ADO.NET Entity FrameWork 4.1 RC 发布 服务器返回json SQL SERVER 2008 MASTER数据库损坏修复
asp.net MVC EF dynamic query
J-Pei · 2011-03-16 · via 博客园 - J-Pei

Entity FrameWork 4.1
public SearchMyThings( string a, string b, int c )
{
     
var mywidgets = DBContext.DbSet<Widget>();
     
     if( !a.IsNullOrEmpty )
        mywidgets
= mywidgets.Where( w => w.AProperty == a );if( !b.IsNullOrEmpty )
        mywidgets
= mywidgets.Where( w => w.BProperty == b );if( c > 0 )
        mywidgets
= mywidgets.Where( c => c.CProperty == c );}