servicestackormlite-servicestackautoquery-servicestackservicestack-autoquery

ServiceStack OrmLite AutoQuery Filter


Should the following work: ?OpensContains=Something by querying the Name column on the db? It doesn't and I'm not sure why not?

 [QueryDbField(Field = "Name")]
 public string OpensContains { get; set; }

?NameContains=Something does work, the column exists, I was assuming that I could add a different Property to the request object that would query the same field using contains.


Solution

  • If you're customizing the field you need to provide the template otherwise it defaults to an = operand, i.e:

    [QueryDbField(Field = "Name", Template = "{Field} LIKE {Value}", ValueFormat = "%{0}%")]