Search code examples
c#servicestackservicestack-autoqueryautoquery-servicestack

ServiceStack AutoQuery AutoFilter Like operand


I am trying to implement SQL Like operator using AutoFilter attribute. Tried the below code,

[AutoFilter(field:"Name", Template = "{Field} like {Value}",  ValueFormat = "%{0}%")]

and the transformed SQL Expression looks like this (from SQL Profiler),

WHERE ("Table"."Name" = @0) AND ("Table"."Name" = @1)',N'@0 nvarchar(4000),@1 varchar(8000)',@0=NULL,@1='denver'

What am I doing wrong? I tried QueryTerm.And,QueryTerm.Or and QueryTerm.Default as well.


Solution

  • You should use [QueryDbField] for Customizable Adhoc Queries.