Autoquery Multiple Wildcards

I can see from the documentation that it is possible to perform a wildcard search against a column when using AutoQuery so that the following SQL is generated:

WHERE ([InterestingColumn] LIKE '%OneThing%') 

Is there a way to perform multiple wilcard searches against one column using AutoQuery so that the resulting SQL would be semantically equivalent to the following:

WHERE ([InterestingColumn] LIKE '%OneThing%') OR ([InterestingColumn] LIKE '%AnotherThing%')

The default query behavior for AutoQuery Services is AND where each additional field acts like a filter. You can change this behavior by annotating your AutoQuery Service with QueryTerm.Or so each criteria are combined, e.g:

public class QueryTable : QueryDb<Table> { }

This will let you specify multiple queries using the same field and have all search criterias combined with OR as seen in your SQL output:


Thanks, mythz.

How would that - if it is possible - be written in C#/F# code? If I have the following (F#) code that does a wildcard search on one value:

let request = QueryTable(InterestingColumnContains="OneThing")

using(new JsonServiceClient(uri))
     (fun client -> client.Get(request)) 

How would I rewrite that for more than one value? How would I also search on “AnotherThing”?

Many thanks.

You can’t have multiple fields on the same DTO, so you would need to use the free path + queryString option, e.g:

var client = new JsonServiceClient(uri);
var response = client.Get<QueryResponse<Table>>(

Note: you don’t need to dispose Service Clients

Or you could use HTTP Utils, e.g:

var json = url.CombineWith("/table/query")
    .AddQueryParam("InterestingColumnContains", "OneThing")
    .AddQueryParam("InterestingColumnContains", "AnotherThing")

var response = json.FromJson<QueryResponse<Table>>();