Beispiel #1
0
        public IClassMapper GetMap(Type entityType)
        {
            if (!_classMaps.TryGetValue(entityType, out IClassMapper map))
            {
                var mapType = GetMapType(entityType) ?? DefaultMapper.MakeGenericType(entityType);

                map = Activator.CreateInstance(mapType) as IClassMapper;
                _classMaps[entityType] = map;
            }

            return(map);
        }
Beispiel #2
0
        public IClassMapper GetMap(Type entityType)
        {
            if (_classMaps.TryGetValue(entityType, out IClassMapper map))
            {
                return(map);
            }
            Type mapType = GetMapType(entityType) ?? DefaultMapper.MakeGenericType(entityType);

            map = Activator.CreateInstance(mapType, new[] { _loggerFactory.CreateLogger(entityType) }) as IClassMapper;
            _classMaps[entityType] = map;

            return(map);
        }
        public IClassMapper GetMap(Type entityType)
        {
            IClassMapper map;

            if (!_classMaps.TryGetValue(entityType, out map))
            {
                Type mapType = GetMapType(entityType);
                if (mapType == null)
                {
                    mapType = DefaultMapper.MakeGenericType(entityType);
                }

                map = Activator.CreateInstance(mapType) as IClassMapper;
                _classMaps[entityType] = map;
            }

            return(map);
        }
        public IClassMapper GetMap(Type entityType)
        {
            IClassMapper map;

            if (!_classMaps.TryGetValue(entityType, out map))
            {
                Type mapType = GetMapType(entityType);
                if (mapType == null)
                {
                    mapType = DefaultMapper.MakeGenericType(entityType);
                }

                map = Activator.CreateInstance(mapType) as IClassMapper;
                var plusitem = map.Properties.Where(p => p.ColumnName.Contains('.')).FirstOrDefault();
                map.Properties.Remove(plusitem);
                _classMaps[entityType] = map;
            }

            return(map);
        }