在Linq中将非列属性值设置为SQL查询 [英] Set a non-column property value in Linq to SQL query
本文介绍了在Linq中将非列属性值设置为SQL查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以在查询中将Linq不会生成的属性设置为SQL设计器(数据库中不是列)?
Is there any way to set a property that is not generated by Linq to SQL designer (is not a column in database) in a query?
例如,是否有类似SomeMethod()的方法:
For example is there such a method like SomeMethod():
IQuaryable<T> query = (from t in context.MyTable
where {some conditions}
select t).SomeMethod("MyPropertyName", value);
推荐答案
类似
var query = (from t in context.MyTable
where {some conditions}
select new {t, MyPropertyName = value });
我不确定这是否是您要的.
im not sure if this is what you're asking or not.
这篇关于在Linq中将非列属性值设置为SQL查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文