private static Dictionary <string, object> ExtractValues(ActivityDataLog dataLog, bool updateOnly)
        {
            Dictionary <string, object> values = new Dictionary <string, object>();
            Type dataLogType = dataLog.GetType();

            var properties = from property in dataLogType.GetProperties()
                             let dataLogAttribute = property.GetCustomAttribute <DataLogPropertyAttribute>()
                                                    where dataLogAttribute != null
                                                    orderby dataLogAttribute.Order
                                                    select new
            {
                Property  = property,
                Attribute = dataLogAttribute
            };

            foreach (var value in properties)
            {
                if (!updateOnly || value.Attribute.IncludeInUpdates)
                {
                    if (value.Property.Name == "RecordId")
                    {
                        values.Add(dataLog.TableName + "Id", value.Property.GetValue(dataLog));
                    }
                    else
                    {
                        values.Add(value.Property.Name, GetPropertyValue(dataLog, value.Property, value.Attribute));
                    }
                }
            }

            return(values);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="DataLoggerMockTable" /> class.
 /// </summary>
 /// <param name="dataLog">The initial <see cref="ActivityDataLog" /> to insert into the table.</param>
 internal DataLoggerMockTable(ActivityDataLog dataLog)
 {
     TableName = dataLog.TableName;
     LogType   = dataLog.GetType();
     Records   = new Dictionary <Guid, DataLoggerMockRecord>();
     Add(dataLog);
 }
        private void ValidateType(ActivityDataLog dataLog)
        {
            Type currentLogType = dataLog.GetType();

            if (currentLogType != LogType)
            {
                throw new DataLoggerMockException($"The {TableName} table received a record of type '{currentLogType}' but expected records of type '{LogType}'.");
            }
        }