//Override to specify behaviour public virtual ModifyEntry GetDiff() { var ret = new ModifyEntry(); ret.IdEntry = this.Id; this.GetType().GetFields().ForEach(x => { var complex = (ComplexType)Attribute.GetCustomAttribute(x, typeof(ComplexType)); ret.Modifiers.Add(new ModifyField() { FieldName = x.Name, FieldValue = complex == null ? x.GetValue(this).ConvertToString() : complex.ConvertToString(x.GetValue(this)) }); }); return(ret); }
public void ApplyDiff(ModifyEntry modify) { modify.Modifiers.ForEach(x => this.ApplyDiff(x.FieldName, x.FieldValue)); }