private int AddMapper(ObjectsMapperDescr descr)
 {
     descr.id = objectsMappersList.Count;
     objectsMappersList.Add(descr);
     objectsMapperIds.Add(descr.key, descr.id);
     return(descr.id);
 }
        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]);
                }
            }
        }