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);
        }
        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);
        }
 internal CloudTablePublisher(ListenableCloudTable parent)
 {
     this._Parent = parent;
 }
 internal CloudTableConsumer(ListenableCloudTable parent, string subscriptionName)
 {
     this._Parent          = parent;
     this.subscriptionName = subscriptionName;
 }