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 void RegisterMapping(Type fromType, object toInstance) { if (FMapper == null) { FInstanceMappings[fromType] = toInstance; } else { FMapper.RegisterMapping(fromType, toInstance); } }
public static void RegisterMapping <TFor, TFrom, TTo>(this IModelMapper mapper) { mapper.RegisterMapping(typeof(TFor), typeof(TFrom), typeof(TTo)); }
/// <summary> /// Registers mapping from TInterface to instance. /// </summary> public static void RegisterMapping <TInterface>(this IModelMapper mapper, TInterface instance) { mapper.RegisterMapping(typeof(TInterface), instance); }