Servicestack - 用于使用自动查询 rdbms 的 OR 运算符 API

Servicestack - OR operator for consuming autoquery rdbms API

有没有办法在查询条件中使用 OR 运算符。我知道可以使用修饰符 [QueryDbField(Term=QueryTerm.Or)] 但这将始终改变 属性 的行为。也许有时我需要使用 AND 查询,有时我需要使用 OR 查询相同的字段。 像

state = la AND amount = 1000 OR totalamount=1000

成为

{url}?state=la&amount=1000&ORtotalamount=1000

您不能像这样在 QueryString adhoc 上指定 OR 条件,但您可以使用自定义模板来创建自定义查询,例如:

public class Query : QueryDb<Table>
{
    public int Amount { get; set; }
    public int TotalAmount { get; set; }

    [QueryDbField(Template = "Amount = {Value} OR TotalAmount = {Value}")]
    public int AnyAmount { get; set; }
}

哪个应该让你然后查询:

?anyamount=1000