/// <summary> /// Compare property values of two specified Settings objects. /// </summary> /// <param name="other"></param> /// <returns></returns> public override Boolean Equals(ISettingsComponent other) { Boolean returnValue = default(Boolean); MVCSettingsComponent otherModel = default(MVCSettingsComponent); try { otherModel = other as MVCSettingsComponent; if (this == otherModel) { returnValue = true; } else { if (!base.Equals(other)) { returnValue = false; } else if (this.SomeOtherInt != otherModel.SomeOtherInt) { returnValue = false; } else if (this.SomeOtherBoolean != otherModel.SomeOtherBoolean) { returnValue = false; } else if (this.SomeOtherString != otherModel.SomeOtherString) { returnValue = false; } else { returnValue = true; } } } catch (Exception ex) { Log.Write(ex, MethodBase.GetCurrentMethod(), EventLogEntryType.Error); throw; } return(returnValue); }
/// <summary> /// Copies property values from source working fields to detination working fields, then optionally syncs destination. /// </summary> /// <param name="destination"></param> /// <param name="sync"></param> public override void CopyTo(ISettingsComponent destination, Boolean sync) { MVCSettingsComponent destinationSettings = default(MVCSettingsComponent); try { destinationSettings = destination as MVCSettingsComponent; destinationSettings.SomeOtherInt = this.SomeOtherInt; destinationSettings.SomeOtherBoolean = this.SomeOtherBoolean; destinationSettings.SomeOtherString = this.SomeOtherString; base.CopyTo(destination, sync);//also checks and optionally performs sync } catch (Exception ex) { Log.Write(ex, MethodBase.GetCurrentMethod(), EventLogEntryType.Error); throw; } }