为什么没有在这拉姆达短路工作吗? [英] Why isn't this short circuit in lambda working?

查看:133
本文介绍了为什么没有在这拉姆达短路工作吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么LINQ试图反正检查第二个表达式

Why linq is trying to check second expression anyway?

.Where(t =>  String.IsNullOrEmpty(someNullString) || t.SomeProperty >= Convert.ToDecimal(someNullstring))

什么是通常的解决办法?

What is usual workaround?

更新:

它是关于LINQ to SQL的,当然。它不能转换为SQL。

Update:
It is about LINQ to SQL, of course. It cannot translate to SQL.

推荐答案

。凡正在对<$ C $使用C>表<> ?

如果是这样,那么任何数据可以抢下前,必须将LINQ转换为SQL要做到这一点就必须转换字符串小数。它不是要实际执行比较的是,它试图建立必要的检索数据的结构。

If so, then before any data can be grabbed, it must convert the LINQ to SQL and to do that it must convert the string into a decimal. It's not trying to actually perform the comparisons yet, it's trying to build the constructs necessary to retrieve data.

这篇关于为什么没有在这拉姆达短路工作吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆