예제 #1
0
        public ModelBackup CreateBackup()
        {
            var backup   = new ModelBackup();
            var accessor = GetTypeAccessor();

            foreach (var propertyName in GetBackupProperties())
            {
                var value = accessor[this, propertyName];
                backup.BackupValues[propertyName] = value;
            }

            return(backup);
        }
예제 #2
0
        public void RestoreBackup(ModelBackup backup)
        {
            var accessor = GetTypeAccessor();

            foreach (var propertyName in GetBackupProperties())
            {
                var value = backup.BackupValues[propertyName];

                if (!IsEqualToBackup(accessor[this, propertyName], value))
                {
                    accessor[this, propertyName] = value;
                }
            }
        }