/// <summary>
 /// Disposes the AWS data writer.
 /// </summary>
 protected virtual void DisposeDataWriter()
 {
     if (DataWriter != null)
     {
         DataWriter.Dispose();
         DataWriter = null;
     }
 }
        /// <summary>
        /// Sends the events.
        /// </summary>
        /// <param name="events">The events that need to be sent.</param>
        /// <remarks>
        /// The subclass must override this method to process the buffered events.
        /// </remarks>
        protected override void SendBuffer(LoggingEvent[] events)
        {
            if (DataWriter == null)
            {
                DataWriter = new DynamoDbDataWriter(ServiceEndpoint, TableName);
            }

            List<Dictionary<string, AttributeValue>> itemList = new List<Dictionary<string, AttributeValue>>();
            foreach (LoggingEvent loggingEvent in events)
            {
                itemList.Add(Parameters.Select(param => param.GetItemAttribute(loggingEvent)).ToDictionary(t => t.Name, t => t.Value));
            }

            DataWriter.WriteItems(itemList);
        }
        /// <summary>
        /// Sends the events.
        /// </summary>
        /// <param name="events">The events that need to be sent.</param>
        /// <remarks>
        /// The subclass must override this method to process the buffered events.
        /// </remarks>
        protected override void SendBuffer(LoggingEvent[] events)
        {
            if (null == DataWriter)
            {
                DataWriter = new DynamoDbDataWriter(ServiceEndpoint);
            }

            foreach (LoggingEvent e in events)
            {
                PutItemRequest request = new PutItemRequest
                {
                    TableName = TableName,
                    Item      = new Dictionary <string, AttributeValue>()
                };

                foreach (DynamoDbAppenderParameter param in Parameters)
                {
                    param.AddFormatParameter(request, e);
                }

                DataWriter.Write(request);
            }
        }
 /// <summary>
 /// Disposes the AWS data writer.
 /// </summary>
 protected virtual void DisposeDataWriter()
 {
     if (DataWriter == null)
         return;
     DataWriter.Dispose();
     DataWriter = null;
 }