Skip to content

Consolidate ResolveUsing to MapFrom#2809

Merged
jbogard merged 4 commits into
masterfrom
consolidate-map-from
Sep 27, 2018
Merged

Consolidate ResolveUsing to MapFrom#2809
jbogard merged 4 commits into
masterfrom
consolidate-map-from

Conversation

@jbogard

@jbogard jbogard commented Sep 26, 2018

Copy link
Copy Markdown
Contributor

Per #2795 discussion

@jbogard jbogard added this to the v.Next milestone Sep 26, 2018
@lbargaoanu

Copy link
Copy Markdown
Contributor

A small thing, but I wouldn't mind seeing UseValue gone :)

@jbogard

jbogard commented Sep 27, 2018

Copy link
Copy Markdown
Contributor Author

Ha, oh right! Because we used to force people to only use MapFrom from properties.

I'd be OK with that,

@lbargaoanu

Copy link
Copy Markdown
Contributor

OK, it should be simple to do. I'll open a PR whenever :)

@jbogard

jbogard commented Sep 27, 2018 via email

Copy link
Copy Markdown
Contributor Author

@lbargaoanu

Copy link
Copy Markdown
Contributor

Nice :)

@jbogard jbogard merged commit 463305f into master Sep 27, 2018
@jbogard jbogard deleted the consolidate-map-from branch September 27, 2018 13:24
@yhnavein

yhnavein commented Nov 30, 2018

Copy link
Copy Markdown

Ok, fantastic. I have replaced ResolveUsing with the MapFrom, but how should I deal nicely with the An expression tree lambda may not contain a null propagating operator error?
That was the whole purpose of using ResolveUsing for me, as it was short and dandy. And I have plenty of null checking in my mappings.

- .ForMember(dest => dest.UserId, opts => opts.ResolveUsing(src => src.User?.Id))
+ .ForMember(dest => dest.UserId, opts => opts.MapFrom(src => src.User?.Id))

I find the following solution unacceptable:

 .ForMember(dest => dest.UserId, opts => opts.MapFrom(src => src.User == null ? (long?) null : src.User.Id))

Is there any other way to deal with this breaking change?

@lbargaoanu

Copy link
Copy Markdown
Contributor

Check the upgrade guide.

@lock

lock Bot commented May 5, 2019

Copy link
Copy Markdown

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock Bot locked as resolved and limited conversation to collaborators May 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants