public static Expression GetMappingOrNull(
            MappingCreationContext context,
            out bool isConditional)
        {
            var mappingData            = context.MappingData;
            var derivedTypeDataSources = DerivedComplexTypeDataSourcesFactory.CreateFor(mappingData);

            if (derivedTypeDataSources.None())
            {
                isConditional = false;
                return(null);
            }

            var derivedTypeDataSourceSet = DataSourceSet.For(
                derivedTypeDataSources,
                mappingData,
                ValueExpressionBuilders.ValueSequence);

            isConditional =
                derivedTypeDataSources.Last().IsConditional&&
                !mappingData.MapperData.TargetType.IsAbstract();

            if (!isConditional)
            {
                context.MappingComplete = true;
            }

            return(derivedTypeDataSourceSet.BuildValue());
        }
        protected override bool ShortCircuitMapping(MappingCreationContext context, out Expression mapping)
        {
            var derivedTypeDataSources = DerivedComplexTypeDataSourcesFactory.CreateFor(context.MappingData);

            if (derivedTypeDataSources.None())
            {
                return(base.ShortCircuitMapping(context, out mapping));
            }

            var derivedTypeDataSourceSet = DataSourceSet.For(
                derivedTypeDataSources,
                context.MapperData,
                ValueExpressionBuilders.ValueSequence);

            mapping = derivedTypeDataSourceSet.BuildValue();

            if (derivedTypeDataSources.Last().IsConditional)
            {
                context.MappingExpressions.Add(mapping);
                return(false);
            }

            var shortCircuitReturns = GetShortCircuitReturns(context.MappingData).ToArray();

            if (shortCircuitReturns.Any())
            {
                context.MappingExpressions.AddRange(shortCircuitReturns);
            }

            if (mapping.NodeType == ExpressionType.Goto)
            {
                mapping = ((GotoExpression)mapping).Value;
                context.MappingExpressions.Add(context.MapperData.GetReturnLabel(mapping));
            }
            else
            {
                context.MappingExpressions.Add(mapping);
                context.MappingExpressions.Add(context.MapperData.GetReturnLabel(mapping.Type.ToDefaultExpression()));
            }

            mapping = Expression.Block(context.MappingExpressions);
            return(true);
        }