Share Link
Copied to clipboard
Embed on Your Page
Copied to clipboard
We Stand with Ukraine
AutoMapper ReadableExpressions Demo by Moar Objects
(src, dest, ctxt) =>
{
    Program.WeddingDto typeMapDestination;
    return (src == null)
        ? null
        : {
            typeMapDestination = dest ?? new Program.WeddingDto();
            try
            {
                var resolvedValue = ((src == null) || false) ? default(DateTime) : src.Date;
                typeMapDestination.Date = resolvedValue;
            }
            catch (Exception ex)
            {
                throw new AutoMapperMappingException(
                    "Error mapping types.",
                    ex,
                    AutoMapper.TypePair,
                    TypeMap,
                    PropertyMap);

                return default(DateTime);
            }
            try
            {
                var resolvedValue = ((src == null) || ((src.Bride == null) || false)) ? default(Program.Title) : src.Bride.Title;
                var propertyValue = resolvedValue.ToString();
                typeMapDestination.BrideTitle = propertyValue;
            }
            catch (Exception ex)
            {
                throw new AutoMapperMappingException(
                    "Error mapping types.",
                    ex,
                    AutoMapper.TypePair,
                    TypeMap,
                    PropertyMap);

                return null;
            }
            try
            {
                var resolvedValue = ((src == null) || ((src.Bride == null) || false)) ? null : src.Bride.Name;
                var propertyValue = (resolvedValue == null) ? null : resolvedValue;
                typeMapDestination.BrideName = propertyValue;
            }
            catch (Exception ex)
            {
                throw new AutoMapperMappingException(
                    "Error mapping types.",
                    ex,
                    AutoMapper.TypePair,
                    TypeMap,
                    PropertyMap);

                return null;
            }
            try
            {
                var resolvedValue = ((src == null) || ((src.Bride == null) || ((src.Bride.Address == null) || false)))
                    ? null
                    : src.Bride.Address.Line1;
                var propertyValue = (resolvedValue == null) ? null : resolvedValue;
                typeMapDestination.BrideAddressLine1 = propertyValue;
            }
            catch (Exception ex)
            {
                throw new AutoMapperMappingException(
                    "Error mapping types.",
                    ex,
                    AutoMapper.TypePair,
                    TypeMap,
                    PropertyMap);

                return null;
            }
            try
            {
                var resolvedValue = ((src == null) || ((src.Groom == null) || false)) ? default(Program.Title) : src.Groom.Title;
                var propertyValue = resolvedValue.ToString();
                typeMapDestination.GroomTitle = propertyValue;
            }
            catch (Exception ex)
            {
                throw new AutoMapperMappingException(
                    "Error mapping types.",
                    ex,
                    AutoMapper.TypePair,
                    TypeMap,
                    PropertyMap);

                return null;
            }
            try
            {
                var resolvedValue = ((src == null) || ((src.Groom == null) || false)) ? null : src.Groom.Name;
                var propertyValue = (resolvedValue == null) ? null : resolvedValue;
                typeMapDestination.GroomName = propertyValue;
            }
            catch (Exception ex)
            {
                throw new AutoMapperMappingException(
                    "Error mapping types.",
                    ex,
                    AutoMapper.TypePair,
                    TypeMap,
                    PropertyMap);

                return null;
            }
            try
            {
                var resolvedValue = ((src == null) || ((src.Groom == null) || ((src.Groom.Address == null) || false)))
                    ? null
                    : src.Groom.Address.Line1;
                var propertyValue = (resolvedValue == null) ? null : resolvedValue;
                typeMapDestination.GroomAddressLine1 = propertyValue;
            }
            catch (Exception ex)
            {
                throw new AutoMapperMappingException(
                    "Error mapping types.",
                    ex,
                    AutoMapper.TypePair,
                    TypeMap,
                    PropertyMap);

                return null;
            }

            return typeMapDestination;
        };
}
Cached Result
Last Run: 2:33:50 pm
Compile: 0.213s
Execute: 0.378s
Memory: 2.24Mb
CPU: 0.375s