Example #1
0
        public void Configure(TypeMap typeMap)
        {
            TypeMap                      = typeMap;
            typeMap.Projection           = Projection;
            typeMap.ConfiguredMemberList = _memberList;
            var globalIgnores = typeMap.Profile.GlobalIgnores;

            if (globalIgnores.Count > 0)
            {
                GlobalIgnores(typeMap, globalIgnores);
            }
            foreach (var action in TypeMapActions)
            {
                action(typeMap);
            }
            if (typeMap.ConstructorMap == null && typeMap.CanConstructorMap())
            {
                MapDestinationCtorToSource(typeMap);
            }
            if (_memberConfigurations != null)
            {
                foreach (var memberConfig in _memberConfigurations)
                {
                    memberConfig.Configure(typeMap);
                }
            }
            if (_sourceMemberConfigurations != null)
            {
                AddSourceMembersConfigurations(typeMap);
            }
            if (_ctorParamConfigurations != null)
            {
                AddCtorParamConfigurations(typeMap);
            }
            if (_valueTransformers != null)
            {
                AddValueTransformers(typeMap);
            }
            _features?.Configure(typeMap);
            if (ReverseMapExpression != null)
            {
                ConfigureReverseMap(typeMap);
            }
        }