/// <summary>
        /// Deletes items from local table that match the given query.
        /// </summary>
        /// <param name="query">A query to find records to delete.</param>
        /// <returns>A task that completes when delete query has executed.</returns>
        /// <exception cref="ArgumentNullException">You must supply a query value</exception>
        public override Task DeleteAsync(MobileServiceTableQueryDescription query)
        {
            if (query == null)
            {
                throw new ArgumentNullException("query");
            }

            this.EnsureInitialized();

            var    formatter = new SqlQueryFormatter(query);
            string sql       = formatter.FormatDelete();

            return(this.operationSemaphore.WaitAsync()
                   .ContinueWith(t =>
            {
                try
                {
                    this.ExecuteNonQueryInternal(sql, formatter.Parameters);
                }
                finally
                {
                    this.operationSemaphore.Release();
                }
            }));
        }
示例#2
0
        /// <summary>
        /// Deletes items from local table that match the given query.
        /// </summary>
        /// <param name="query">A query to find records to delete.</param>
        /// <returns>A task that completes when delete query has executed.</returns>
        public override Task DeleteAsync(MobileServiceTableQueryDescription query)
        {
            if (query == null)
            {
                throw new ArgumentNullException("query");
            }

            this.EnsureInitialized();

            var    formatter = new SqlQueryFormatter(query);
            string sql       = formatter.FormatDelete();

            this.ExecuteNonQuery(sql, formatter.Parameters);

            return(Task.FromResult(0));
        }