/** * Return a new query based on this query with an additional where clause added. * @param json Json representation of the where clause. * @return A new EntityQuery. */ public EntityQuery Where(String json) { var qmap = JsonConvert.DeserializeObject <Dictionary <string, object> >(json); var pred = BasePredicate.PredicateFromMap(qmap); return(this.Where(pred)); }
/** * Materializes the serialized json representation of an EntityQuery. * @param json The serialized json version of the EntityQuery. */ public EntityQuery(String json) { if (json == null || json.Length == 0) { return; } Dictionary <string, object> qmap; try { var dmap = JsonHelper.Deserialize(json); qmap = (Dictionary <string, object>)dmap; } catch (Exception) { throw new Exception( "This EntityQuery ctor requires a valid json string. The following is not json: " + json); } this._resourceName = GetMapValue <string>(qmap, "resourceName"); this._skipCount = GetMapInt(qmap, "skip"); this._takeCount = GetMapInt(qmap, "take"); this._wherePredicate = BasePredicate.PredicateFromMap(GetMapValue <Dictionary <string, object> >(qmap, "where")); this._orderByClause = OrderByClause.From(GetMapValue <List <Object> >(qmap, "orderBy")); this._selectClause = SelectClause.From(GetMapValue <List <Object> >(qmap, "select")); this._expandClause = ExpandClause.From(GetMapValue <List <Object> >(qmap, "expand")); this._parameters = GetMapValue <Dictionary <string, object> >(qmap, "parameters"); this._inlineCountEnabled = GetMapValue <bool?>(qmap, "inlineCount"); }