예제 #1
0
 protected void InitializeForReal(IModelMapper parentMapper)
 {
     FMapper = parentMapper.CreateChildMapper(Model);
     foreach (var mapping in FInstanceMappings)
     {
         FMapper.RegisterMapping(mapping.Key, mapping.Value);
     }
     foreach (var mapping in FDefaultInstanceMappings)
     {
         FMapper.RegisterDefault(mapping.Key, mapping.Value);
     }
     foreach (var mapping in FTypeMappings)
     {
         FMapper.RegisterMapping(mapping[0], mapping[1], mapping[2]);
     }
     OnInitialized();
 }
예제 #2
0
 public void RegisterMapping(Type fromType, object toInstance)
 {
     if (FMapper == null)
     {
         FInstanceMappings[fromType] = toInstance;
     }
     else
     {
         FMapper.RegisterMapping(fromType, toInstance);
     }
 }
예제 #3
0
 public static void RegisterMapping <TFor, TFrom, TTo>(this IModelMapper mapper)
 {
     mapper.RegisterMapping(typeof(TFor), typeof(TFrom), typeof(TTo));
 }
예제 #4
0
 /// <summary>
 /// Registers mapping from TInterface to instance.
 /// </summary>
 public static void RegisterMapping <TInterface>(this IModelMapper mapper, TInterface instance)
 {
     mapper.RegisterMapping(typeof(TInterface), instance);
 }