I am trying to deserialize Kondo filter object, which is passed to my API withing query string:
?groupBy=4&groupDir=asc&filter%5Blogic%5D=and&filter%5Bfilters%5D%5B0%5D%5Bfield%5D=List&filter%5Bfilters%5D%5B0%5D%5Boperator%5D=eq&filter%5Bfilters%5D%5B0%5D%5Bvalue%5D=34727&sort%5B0%5D%5Bfield%5D=priority&sort%5B0%5D%5Bdir%5D=asc&sortContext=34727&tzo=3600&tz=Europe/London&_=1443780599583
filter[filters][0][field] = List
filter[filters][0][operator] = eq
filter[filters][0][value] = 34727
filter[logic] = and
groupBy = 4
groupDir = asc
[DataContract]
public class KendoFilter
{
[DataMember(Name = "field")]
public string Field { get; set; }
[DataMember(Name = "operator")]
public string Operator { get; set; }
[DataMember(Name = "value")]
public object Value { get; set; }
[DataMember(Name = "logic")]
public string Logic { get; set; }
[DataMember(Name = "filters")]
public IEnumerable<KendoFilter> Filters { get; set; }
}
It works perfectly in Controller using model binders.
public HttpResponseMessage Get([FromUri] KendoFilter filter)
But in my API i am using command pattern inkstand of controllers. So i am forced to deserialize it from raw query string.
Aucun commentaire:
Enregistrer un commentaire