-
Notifications
You must be signed in to change notification settings - Fork 27
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
Mapping Property Object Over Target #64
Comments
Hi! That's probably as good a way of doing it as exists currently - is there a configuration syntax or way of performing the mapping you'd like to be able to use? Depending on your configuration-placement preferences, it's a tiny bit neater configuring it inline, imo: var modelDto = model.Map().ToANew<ModelDto>(cfg => cfg
.After.MappingEnds
.Call((m, dto) => m.Statistics.Map().Over(dto))); |
Hi, Thanks for a fast response. I was hoping to find something like cfg => cfg.WhenMapping.From<Video>()
.To<YoutubeVideo>()
.Map(ctx => ctx.Source.Statistics).ToSelf() or maybe .Manual((t, s) => t.Statistics.Map().Over(s)); |
I like Thanks for the feedback! :) |
…et mapping, re: issue #64 / Updating type converters to structs
* Support for configuring complex type members as sources for root target mapping, re: issue #64 / Updating type converters to structs * Adding ToTarget() configuration API method * Catching invalid .ToTarget() API configurations * Start of handling runtime-type-checking of configured root target source members * Support for overwrite mapping from configured root target sources * Short-circuiting Relative member chain creation when possible * Increased test coverage for root target data sources - invalid configurations and values with no member matches * Support for conditional configured root source members * Tidying / Start of support for configured enumerable root data sources * Replacing uses of Linq Select() and Where() * Support for configured enumerable root source members * Support for multiple configured root enumerable data sources * Test coverage for configuring multiple complex type root source members and root source members inline * Support for runtime-typed configured root source members * Support for mapping configured root data sources to dictionaries * Test coverage for configured root source member mapping to dynamic
Added in the latest code - release to follow: Mapper.WhenMapping
.From<Video>().To<YoutubeVideo>()
.Map(ctx => ctx.Source.Statistics)
.ToTarget(); ...or: var youtubeVideo = video.Map()
.ToANew<YoutubeVideo>(cfg => cfg
.Map(ctx => ctx.Source.Statistics)
.ToTarget()); |
Available in v0.24 - thanks for the feedback! :) |
Is there a better way to do this?:
I want to map Statistics property Over ModelDto, since it doesn't have a seperate property for statistics?
The text was updated successfully, but these errors were encountered: