Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sql where 表达式树里求值的疑问 #48

Closed
kaanid opened this issue Feb 1, 2019 · 1 comment
Closed

sql where 表达式树里求值的疑问 #48

kaanid opened this issue Feb 1, 2019 · 1 comment

Comments

@kaanid
Copy link

kaanid commented Feb 1, 2019

sql where 表达式树里求值的疑问
如:

[Fact]
public void TestWhere_17_1()
{
        
        //执行
       _clause.Where<Sample>(t => t.Created>Datetime.Now.AddDays(-7));

 }

这种情况,如何处理?

提倡提前计算好,再进行表达式树的方法。

是否可以支持这种方式:

可通过下面这样方法来求值

Expression.Lambda(expression).Compile().DynamicInvoke();
@UtilCore
Copy link
Contributor

UtilCore commented Feb 9, 2019

一般情况下提前进行计算是推荐的方法。
lambda表达式中如果要支持特定的语法,必须进行特定的测试,另外可能会把某些方法调用转换成数据库内部函数,目前SqlQuery还处于基础实现阶段,高级特性尚未考虑。
使用DynamicInvoke可能会出现非预期的结果,暂时不会考虑这个方案。

@UtilCore UtilCore closed this as completed Feb 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants