example of json file
{ "projectname": "14010-00 general expenses", "clientname": "whiting", "created": "2015-06-26t21:06:17.721z", "data": { "function": "lit", "tag": "1461", "rack": "1", "slot": "4", "channel": "1" } }, { "projectname": "104021-00 cpf", "clientname": "bonanza creek", "created": "2015-06-26t21:03:20.732z", "data": { "tag": "200", "function": "ft", "basemodel": "ft-200", "shortdescription": "" } } and want filter based on contents of data varies between different components. component.cs file possesses
public class component{ public string clientname{get; set;} public string projectname{get; set;} ... public idictionary<string, object> data { get; set; } } the problem might dictionary being composed of string,object instead of string,string yet most, if not all, of data's values strings anyway.
so
~/component?$filter=clientname eq 'whitning' will work; however, query fails on
~/component?$filter=data/function eq 'ft' and gives error response "the parent value property access of property 'function' not single value. property access can applied single value." , trying
~/component?$filter=data/any(d: d/function eq 'ft') gives error response "could not find property named 'function' on type 'system.collections.generic.keyvaluepair_2ofstring_object'."
so how can filter objects inside data object dynamically created , not present?
are using web api odata? if yes, data container dynamic property. shouldn't present in payload. payload should be:
{ "id": "558dbec9940bc716801a95d4", "facilityname": "ray", "projectname": "14010-00 general expenses", "clientname": "whiting", "projectnames": [], "name": "iolist", "created": "2015-06-26t21:06:17.721z", "updated": "2015-06-26t21:06:17.721z", "function": "lit", "tag": "1461", "rack": "1", "slot": "4", "channel": "1" },{ ...
Comments
Post a Comment