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