Esempio n. 1
0
        private static LogTableRecord BuildRecord(FrameworkDataLog dataLog, bool insert)
        {
            if (dataLog == null)
            {
                throw new ArgumentNullException(nameof(dataLog));
            }

            LogTableRecord record = new LogTableRecord();

            foreach (DataLogPropertyInfo dataLogProperty in GetDataLogProperties(dataLog))
            {
                bool isPrimaryKey = dataLogProperty.Name.Equals(dataLog.PrimaryKeyColumn);
                if (insert || dataLogProperty.IncludeInUpdates || isPrimaryKey)
                {
                    record.Add(dataLogProperty.Name, GetPropertyValue(dataLogProperty, dataLog));
                }
            }
            return(record);
        }
Esempio n. 2
0
        private static LogTableRecord BuildRecord(ActivityDataLog dataLog, bool insert)
        {
            if (dataLog == null)
            {
                throw new ArgumentNullException(nameof(dataLog));
            }

            // Build the table definition so that we can use the primary key
            LogTableDefinition tableDefinition = new LogTableDefinition(dataLog.TableName);

            LogTableRecord record = new LogTableRecord();

            foreach (DataLogPropertyInfo dataLogProperty in GetDataLogProperties(dataLog))
            {
                bool isPrimaryKey = dataLogProperty.Name.Equals(nameof(ActivityDataLog.RecordId));
                if (insert || dataLogProperty.IncludeInUpdates || isPrimaryKey)
                {
                    // Special case: change "RecordId" to the primary key name
                    string columnName = isPrimaryKey ? tableDefinition.PrimaryKey : dataLogProperty.Name;
                    record.Add(columnName, GetPropertyValue(dataLogProperty, dataLog));
                }
            }
            return(record);
        }