public ObjectsMapperDescr(ObjectsMapperBaseImpl mapper, MapperKey key, int id) { this.mapper = mapper; this.key = key; this.id = id; }
private ObjectsMapperDescr GetMapperByKey(MapperKey key) { return(objectsMappersList[objectsMapperIds[key]]); }
private bool IsMapperCreated(MapperKey key) { return(objectsMapperIds.ContainsKey(key)); }
internal ObjectsMapperDescr GetMapperInt( Type from, Type to, IMappingConfigurator mappingConfigurator) { lock (this) { if (to == null) { to = typeof(object); } if (from == null) { from = typeof(object); } MapperKey MapperTypeKey = new MapperKey(from, to, mappingConfigurator.GetConfigurationName()); ObjectsMapperDescr result; int mapperId; if (!objectsMapperIds.TryGetValue(MapperTypeKey, out mapperId)) { result = new ObjectsMapperDescr( null, MapperTypeKey, 0 ); AddMapper(result); string MapperTypeName = GetMapperTypeName(from, to); ObjectsMapperBaseImpl createdMapper; if (MapperPrimitiveImpl.IsSupportedType(to)) { createdMapper = new MapperPrimitiveImpl(this, from, to, mappingConfigurator); } else if (MapperForCollectionImpl.IsSupportedType(to)) { ObjectsMapperDescr Mapper = GetMapperInt( MapperForCollectionImpl.GetSubMapperTypeFrom(from), MapperForCollectionImpl.GetSubMapperTypeTo(to), mappingConfigurator); createdMapper = MapperForCollectionImpl.CreateInstance( MapperTypeName + GetNextMapperId(), this, from, to, Mapper, mappingConfigurator ); } else { createdMapper = BuildObjectsMapper( MapperTypeName + GetNextMapperId(), from, to, mappingConfigurator ); } result.mapper = createdMapper; return(result); } else { return(objectsMappersList[mapperId]); } } }