/// <summary>
        /// Batching is about more than just committing a bunch of rows at one time, it also has an impact on cost. 
        /// Remember how Azure Table Storage charges you $0.0000001 per “transaction”? 
        /// 
        /// By the time I write these lines:
        /// 
        /// There are no limits to the number of tables you can create in Windows Azure. 
        /// 
        /// 1.- single operation: the size of the entity must be a maximum of 64KB 
        /// 2.- batch operation : max of 100 entities or 4MB (per batch)
        /// 3.- batch operation: all items in a batch must have the same partition key
        /// 
        /// </summary>
        private void TraceDataBatchOperation(string categorySource, AzureTableStorageListenerEntity azureEntityLog)
        {
            if (!this._tableBatchOperationList.ContainsKey(categorySource))
            {
                this._tableBatchOperationList.Add(categorySource, new List<TableOperation>());
            }

            List<TableOperation> operationList = this._tableBatchOperationList[categorySource];

            operationList.Add(TableOperation.Insert(azureEntityLog));

            if (operationList.Count == this._tableBatchOperationListLimit)
            {
                CloudTable table = this.TableClient().GetTableReference(categorySource);
                table.CreateIfNotExists();

                var batch = new TableBatchOperation();
                for (int i = 0; i < operationList.Count; i++)
                {
                    batch.Insert(i, operationList[i]);
                }
                table.ExecuteBatch(batch);

                operationList.Clear();
            }
        }
 private void TraceDataSingleOperation(string categorySource, AzureTableStorageListenerEntity azureEntityLog)
 {
     if (this.TableClient() != null)
     {
         CloudTable table = this.TableClient().GetTableReference(categorySource);
         table.CreateIfNotExists();
         table.Execute(TableOperation.Insert(azureEntityLog));
     }
 }
        public override void TraceData(TraceEventCache eventCache, string source, TraceEventType eventType, int id, object data)
        {
            if (this.TableClient() != null)
            {
                //if (data is LogEntry && this.Formatter != null)
                if (data is LogEntry)
                {
                    LogMessageModel logMessage = new LogMessageModel(data as LogEntry);
                    AzureTableStorageListenerEntity azureLogEntity = new AzureTableStorageListenerEntity(logMessage);

                    if (ApplicationConfiguration.IsDebugMode)
                    {
                        this.TraceDataSingleOperation(logMessage.Category, azureLogEntity);
                    }
                    else
                    {
                        this.TraceDataBatchOperation(logMessage.Category, azureLogEntity);
                    }
                }
                else
                {
                    //this.WriteLine(data.ToString());
                }
            }
            else
            {

            }
        }