コード例 #1
0
        public async Task <bool> AddAsync(DynamicTableEntity entity)
        {
            if (_Parent.CloudTable != null)
            {
                try
                {
                    await _Parent.CloudTable.ExecuteAsync(TableOperation.Insert(entity)).ConfigureAwait(false);
                }
                catch (StorageException ex)
                {
                    if (ex.RequestInformation != null && ex.RequestInformation.HttpStatusCode == 409)
                    {
                        return(false);
                    }
                    throw;
                }
            }
            var client  = CreateTopicClient();
            var message = ListenableCloudTable.FromTableEntity(entity);

            message.Properties.Add("Addition", "true");
            message.PartitionKey         = entity.PartitionKey;
            message.Properties["RowKey"] = entity.RowKey;
            await client.SendAsync(message).ConfigureAwait(false);

            return(true);
        }
コード例 #2
0
        private static CloudTableEvent ToCloudTableEvent(BrokeredMessage message)
        {
            if (message == null)
            {
                return(null);
            }
            CloudTableEvent evt = new CloudTableEvent();

            evt.Addition = message.Properties["Addition"].ToString() == "true";
            if (evt.Addition)
            {
                evt.AddedEntity = ListenableCloudTable.ToTableEntity(message);
            }
            evt.PartitionKey = evt.PartitionKey;
            evt.RowKey       = message.Properties["RowKey"].ToString();
            return(evt);
        }
コード例 #3
0
 internal CloudTablePublisher(ListenableCloudTable parent)
 {
     this._Parent = parent;
 }
コード例 #4
0
 internal CloudTableConsumer(ListenableCloudTable parent, string subscriptionName)
 {
     this._Parent          = parent;
     this.subscriptionName = subscriptionName;
 }