public override int GetHashCode() { int hash = 1; if (Name.Length != 0) { hash ^= Name.GetHashCode(); } if (Skip != false) { hash ^= Skip.GetHashCode(); } if (Hide != false) { hash ^= Hide.GetHashCode(); } if (RenameTo.Length != 0) { hash ^= RenameTo.GetHashCode(); } hash ^= alias_.GetHashCode(); hash ^= attrDefault_.GetHashCode(); hash ^= attrRename_.GetHashCode(); hash ^= inputRename_.GetHashCode(); hash ^= outputRename_.GetHashCode(); return(hash); }
/** * Used to map source public properties to the destination public properties (DTO). * You can use annotations for custom naming else the same name will be used. */ public static void Automap(object source, object destination) { PropertyInfo[] sourceProperties = source.GetType().GetProperties(); foreach (PropertyInfo property in sourceProperties) { Skip skip = property.GetCustomAttribute <Skip>(); if (skip != null) { continue; } RenameTo renamer = property.GetCustomAttribute <RenameTo>(); if (renamer != null) { SetPropertyValue(property, destination, source, renamer.DestinationName); } else { SetPropertyValue(property, destination, source, property.Name); } } }