/// <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); MVCSettings otherSettings = default(MVCSettings); try { otherSettings = other as MVCSettings; if (this == otherSettings) { returnValue = true; } else { if (!base.Equals(other)) { returnValue = false; } else if (!this.SomeComponent.Equals(otherSettings)) { returnValue = false; } else if (this.SomeInt != otherSettings.SomeInt) { returnValue = false; } else if (this.SomeBoolean != otherSettings.SomeBoolean) { returnValue = false; } else if (this.SomeString != otherSettings.SomeString) { 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(/*ISettings*/ ISettingsComponent destination, Boolean sync) { MVCSettings destinationSettings = default(MVCSettings); try { destinationSettings = destination as MVCSettings; //destinationSettings.SomeComponent = this.SomeComponent; this.SomeComponent.CopyTo(destinationSettings.SomeComponent, sync); destinationSettings.SomeInt = this.SomeInt; destinationSettings.SomeBoolean = this.SomeBoolean; destinationSettings.SomeString = this.SomeString; base.CopyTo(destination, sync);//also checks and optionally performs sync } catch (Exception ex) { Log.Write(ex, MethodBase.GetCurrentMethod(), EventLogEntryType.Error); throw; } }