AutoMapper.Execution.TypeMapPlanBuilder.CreateMapperLambda C# (CSharp) Method

CreateMapperLambda() public method

public CreateMapperLambda ( ) : LambdaExpression
return System.Linq.Expressions.LambdaExpression
        public LambdaExpression CreateMapperLambda()
        {
            if(_typeMap.SourceType.IsGenericTypeDefinition() || _typeMap.DestinationTypeToUse.IsGenericTypeDefinition())
            {
                return null;
            }
            var customExpression = TypeConverterMapper() ?? _typeMap.Substitution ?? _typeMap.CustomMapper ?? _typeMap.CustomProjection;
            if(customExpression != null)
            {
                return Lambda(customExpression.ReplaceParameters(_source, _initialDestination, _context), _source, _initialDestination, _context);
            }
            bool constructorMapping;

            var destinationFunc = CreateDestinationFunc(out constructorMapping);

            var assignmentFunc = CreateAssignmentFunc(destinationFunc, constructorMapping);

            var mapperFunc = CreateMapperFunc(assignmentFunc);

            var checkContext = CheckContext(_typeMap, _context);
            var lambaBody = (checkContext != null) ? new[] { checkContext, mapperFunc } : new[] { mapperFunc };

            return Lambda(Block(new[] { _destination }, lambaBody), _source, _initialDestination, _context);
        }