Exemple #1
0
        /// <summary>
        /// Get an element from a table by its id.
        /// </summary>
        /// <param name="id">
        /// The id of the element.
        /// </param>
        /// <param name="parameters">
        /// A dictionary of user-defined parameters and values to include in
        /// the request URI query string.
        /// </param>
        /// <returns>
        /// The desired element as JSON object.
        /// </returns>
        private async Task <JObject> GetSingleValueAsync(object id, IDictionary <string, string> parameters)
        {
            Arguments.IsNotNull(id, nameof(id));

            // Create a query for just this item
            string query = $"$filter=({MobileServiceSystemColumns.Id} eq {ODataExpressionVisitor.ToODataConstant(id)})";

            // Send the query
            QueryResult response = await ReadAsync(query, parameters, MobileServiceFeatures.TypedTable);

            return(GetSingleValue(response));
        }
Exemple #2
0
        /// <summary>
        /// Get an element from a table by its id.
        /// </summary>
        /// <param name="id">
        /// The id of the element.
        /// </param>
        /// <param name="parameters">
        /// A dictionary of user-defined parameters and values to include in
        /// the request URI query string.
        /// </param>
        /// <returns>
        /// The desired element as JSON object.
        /// </returns>
        private async Task <JObject> GetSingleValueAsync(object id, IDictionary <string, string> parameters)
        {
            Debug.Assert(id != null);

            // Create a query for just this item
            string query = string.Format(
                CultureInfo.InvariantCulture,
                "$filter=({0} eq {1})",
                MobileServiceSystemColumns.Id,
                ODataExpressionVisitor.ToODataConstant(id));

            // Send the query
            QueryResult response = await this.ReadAsync(query, parameters, MobileServiceFeatures.TypedTable);

            return(GetSingleValue(response));
        }