Skip to content

Boxed.Mapping: Allow source to be null (and set destination to null if so) #711

Open
@Kazpers

Description

@Kazpers

Describe the feature

Currently the Boxed.Mapping.MapperExtensions.Map method specifically checks whether source == null and throws an ArgumentNullException if so. It would be nice if it instead followed .NET nullable rules, and allowed a null source if the mapper defined a nullable type as source. In that case the destination would obviously also simply be null.

Instead, you currently have to do a workaround like: "var result = source == null ? null : _mapper.Map(source)" on every line calling a mapper where the source is a nullable type.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementIssues or pull requests adding an enhancement.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions