fluentsprings / ExpressMapper

Mapping .Net types
http://www.expressmapper.org
Other
310 stars 65 forks source link

Need a small improvement to the flatten name matching #147

Closed RudeySH closed 5 years ago

RudeySH commented 6 years ago

I just started using ExpressMapper and I'm already heavily relying on the flatten functionality. I like how it maps src.Inner.SomeProperty to dest.InnerSomeProperty. However, I am wondering, why can't it map src.Inner.SomeProperty to just dest.SomeProperty in cases where the outer class does not have a SomeProperty himself?

RudeySH commented 6 years ago

@JonPSmith Any thoughts on this? I noticed you were the one who implemented Flatten, you might have an answer for me :)

JonPSmith commented 6 years ago

Hi @RudeySH,

The flattening I added is fairly basic, but I have written a long article that explains how it works.

I was planning to change from AutoMapper to ExpressMapper, but two things have stopped me from doing that:

RudeySH commented 6 years ago

Thanks @JonPSmith . In the meanwhile I have done some experimenting with ExpressMapper and I already feel like I should switch to AutoMapper because of all the issues I'm running in to.

Slightly off topic, but are the performance tests between ExpressMapper and other mappers purely focussed on the initial set up performance? I will maily be using mapping for EF queries and I am worried that AutoMapper will slow my queries down.

JonPSmith commented 6 years ago

Hi @RudeySH,

It was a while ago but ExpressMapper and AutoMapper LINQ->EF were the same. They should produce similar LINQ and its then up to EF to convert it.

RudeySH commented 6 years ago

It turns out this is pretty easily done in AutoMapper. https://github.com/AutoMapper/AutoMapper/issues/2489

JonPSmith commented 6 years ago

Good to know. Thanks.