我们有一个对象。
public class SomeObject
{
public Name {get;set;}
public City {get;set;}
public State {get;set}
//various other parameters. Let's say there's ~20
}
能否在不重新编译源代码的情况下动态创建新的LINQ查询?相反,查询参数来自存储和更新在数据库中的XML结构。
var result = from i in someObj
where
//XML requests Name = 'Bob'...so append this where clause
name = 'Bob'
这能做到吗?
Name = 'Bob' || Name = 'Fred'
。条件只能用&&组合吗?例如Name = 'Bob' && State = 'OH'
。还是条件可以用||组合?例如Name = 'Bob' || State = 'OH'
。在提出解决方案之前,所有这些都需要考虑到。 - cadrell0