Пример #1
0
        public virtual void Compile(ModuleBuilder builder)
        {
            var sourceType = SourceType;
            var targetType = TargetMember.MemberType;

            if (_converter == null)
            {
                _converter = _container.Converters.Get(sourceType, targetType);
            }
            if (_converter == null)
            {
                _converter = CreateConverter(sourceType, targetType);
            }
            _converter?.Compile(builder);
            if (_mapper == null)
            {
                _mapper = CreateMapper(sourceType, targetType);
            }
            _mapper?.Compile(builder);
            if ((_converter == null || _mapper == null) && HasOption(MemberMapOptions.Hierarchy) && !(
                    TargetMember.MemberType.GetTypeInfo().IsValueType &&
                    targetType == sourceType))
            {
                EnsureMapperType(sourceType, targetType, builder);
            }
        }