Example #1
0
        /**
         * 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");
        }
Example #2
0
 /**
  * Copy constructor
  * @param query
  */
 public EntityQuery(EntityQuery query)
 {
     this._resourceName       = query._resourceName;
     this._skipCount          = query._skipCount;
     this._takeCount          = query._takeCount;
     this._wherePredicate     = query._wherePredicate;
     this._orderByClause      = query._orderByClause;
     this._selectClause       = query._selectClause;
     this._expandClause       = query._expandClause;
     this._inlineCountEnabled = query._inlineCountEnabled;
     this._parameters         = query._parameters;
 }