Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Kazpers opened this issue May 15, 2024 · 0 comments
Open
Labels
enhancement Issues or pull requests adding an enhancement.

Comments

@Kazpers
Copy link

Kazpers commented May 15, 2024

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.

@Kazpers Kazpers added the enhancement Issues or pull requests adding an enhancement. label May 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Issues or pull requests adding an enhancement.
Projects
None yet
Development

No branches or pull requests

1 participant