Ejemplo n.º 1
0
 public static IMemberSetter For(MemberInfo mi)
 {
     if (mi.MemberType == MemberTypes.Property)
     {
         return(MemberSetterCreator.For((PropertyInfo)mi));
     }
     else if (mi.MemberType == MemberTypes.Field)
     {
         return(MemberSetterCreator.For((FieldInfo)mi));
     }
     return(null);
 }
Ejemplo n.º 2
0
 internal Boolean TryMapping(IMemberGetter getter, MemberInfo[] miDsts, bool ignoreMap = false, bool useAutoMapper = false)
 {
     foreach (MemberInfo miDst in miDsts)
     {
         IMemberSetter setter = MemberSetterCreator.For(miDst);
         if (setter == null)
         {
             continue;
         }
         if (setter.SetterType.IsAssignableFrom(getter.GetterType))
         {
             GettersAndSetters.Add(new GetterAndSetter(getter, setter));
         }
         else if (useAutoMapper)
         {
             GettersAndSetters.Add(new MapperGetterAndSetter(getter, setter, AutoMapper.Build(getter.GetterType, setter.SetterType)));
         }
         return(true);
     }
     return(false);
 }