Exemple #1
0
 public void RegisterDefault(Type fromType, object toInstance)
 {
     if (FMapper == null)
     {
         FDefaultInstanceMappings[fromType] = toInstance;
     }
     else
     {
         FMapper.RegisterDefault(fromType, toInstance);
     }
 }
Exemple #2
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();
 }
Exemple #3
0
 public static void RegisterDefault <TInterface>(this IModelMapper mapper, TInterface instance)
 {
     mapper.RegisterDefault(typeof(TInterface), instance);
 }