Ejemplo n.º 1
0
        public async Task AddRegistryEntries(IEnumerable <Tvq> tvqs)
        {
            // Create the table client.
            var tableClient = m_StorageAccount.CreateCloudTableClient();

            // Create the table if it doesn't exist.
            var table = tableClient.GetTableReference("registryentries");
            await table.CreateIfNotExistsAsync();

            foreach (var tvq in tvqs)
            {
                var tvqEntity       = new TvqEntity(m_PartitionKey, tvq);
                var insertOperation = TableOperation.Insert(tvqEntity);

                // Execute the insert operation.
                await table.ExecuteAsync(insertOperation);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Deletes an entry
        /// </summary>
        /// <param name="t"></param>
        /// <returns>True if successful</returns>
        public async Task <bool> DeleteRegistryEntry(DateTime t)
        {
            // Create the table client.
            var tableClient = m_StorageAccount.CreateCloudTableClient();

            // Create the table if it doesn't exist.
            var table = tableClient.GetTableReference("registryentries");
            await table.CreateIfNotExistsAsync();

            var entity = new TvqEntity(m_PartitionKey, new Tvq(t, 0, Quality.Ok))
            {
                ETag = "*"
            };
            var deleteOperation = TableOperation.Delete(entity);
            var result          = await table.ExecuteAsync(deleteOperation);

            var ok = result.HttpStatusCode == (int)HttpStatusCode.NoContent;

            return(ok);
        }