Ejemplo n.º 1
0
        /// <summary> Load a range of database objects from a table using the specified index. </summary>
        /// <param name="table"> The table to load the database object from. </param>
        /// <param name="index"> The name of the index to query for the database object. </param>
        /// <param name="indexPath"> Where in the index to start the range search: An array of objects of the same types as the index properties, specifying where in the index to start loading database objects from. IndexPath can be set to null if there is only one property in the index.</param>
        /// <param name="start"> Where to start the range search. For instance, if the index is [Mode,Map,Score] and indexPath is ["expert","skyland"], then start defines the minimum score to include in the results</param>
        /// <param name="stop"> Where to stop the range search. </param>
        /// <param name="limit"> The max amount of objects to return. </param>
        /// <param name="successCallback"> A callback containing the database objects found. </param>
        public DatabaseObject[] LoadRange(string table, string index, object[] indexPath, object start, object stop, int limit)
        {
            var startIndex = indexPath.Select(BigDBObjectValue.Create).ToList();

            if (start != null)
            {
                startIndex.Add(BigDBObjectValue.Create(start));
            }

            var stopIndex = indexPath.Select(BigDBObjectValue.Create).ToList();

            if (stop != null)
            {
                stopIndex.Add(BigDBObjectValue.Create(stop));
            }

            var loadRangeOutput = _channel.Request <LoadIndexRangeArgs, LoadObjectsOutput, PlayerIOError>(97, new LoadIndexRangeArgs {
                Table           = table,
                Index           = index,
                StartIndexValue = startIndex.ToArray(),
                StopIndexValue  = stopIndex.ToArray(),
                Limit           = limit,
            });

            foreach (var obj in loadRangeOutput.Objects)
            {
                obj.Table = table;
            }

            return(loadRangeOutput.Objects);
        }
Ejemplo n.º 2
0
        public virtual DatabaseObject Set(string propertyExpression, object value)
        {
            this.Properties.Add(propertyExpression, BigDBObjectValue.Create(value));

            return(this);
        }