internal void CopyNonNullValuesFromsObject(sObject i_Src) { if (i_Src == null) { return; } // Check myself and i_src are same type Type myDerivedType = GetType(); if (myDerivedType != i_Src.GetType()) { return; } //TODO: Check ids? BindingFlags propertiesSearchFlags = BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public; IEnumerable <PropertyInfo> nonEmptyProperties = myDerivedType.GetProperties(propertiesSearchFlags); foreach (PropertyInfo propertyToCopy in nonEmptyProperties) { object valueToCopy = propertyToCopy.GetValue(i_Src); if (DeserializationUtils.ShouldCopyPropertyValue(propertyToCopy, valueToCopy)) { propertyToCopy.SetValue(this, valueToCopy); } } }
public override bool Equals(object obj) { if (obj == null) { return(false); } sObject objectToCompare = obj as sObject; if (objectToCompare == null) { return(false); } if (Id != objectToCompare.Id) { return(false); } if (string.IsNullOrEmpty(Id)) { return(base.Equals(obj)); } return(true); }