Beispiel #1
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = (Id != null ? Id.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (int)TargetType;
         hashCode = (hashCode * 397) ^ (TargetTypeName != null ? TargetTypeName.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (TargetAttribute != null ? TargetAttribute.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (RuleConditions != null ? RuleConditions.GetHashCode() : 0);
         return(hashCode);
     }
 }
Beispiel #2
0
        public ClassMap(Type sourceType, Type targetType)
        {
            SourceType         = sourceType;
            TargetType         = targetType;
            SourceTypeName     = sourceType.Name;
            TargetTypeName     = targetType.Name;
            SourceTypeFullName = sourceType.FullName.Replace("+", ".");
            TargetTypeFullName = targetType.FullName.Replace("+", ".");
            SourceVariable     = Char.ToLower(SourceTypeName[0]) + SourceTypeName.Substring(1);
            TargetVariable     = Char.ToLower(TargetTypeName[0]) + TargetTypeName.Substring(1);

            var sourceProperties = SourceType.GetProperties().Select(x => new Prop(x));
            var targetProperties = TargetType.GetProperties().Select(x => new Prop(x));

            PropMaps = sourceProperties
                       .Join(targetProperties, s => s.Name, t => t.Name, (s, t) => new PropMap(s, t))
                       .Select(x => x)
                       .ToList();
        }