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

Object not being mapped during Deep Clone #89

Closed
SteveWilkes opened this issue Nov 29, 2016 · 2 comments
Closed

Object not being mapped during Deep Clone #89

SteveWilkes opened this issue Nov 29, 2016 · 2 comments

Comments

@SteveWilkes
Copy link

Hi,

I've written a project to test the performance of various mappers at different tasks, and it looks to have uncovered an issue in Mapster's deep-cloning.

The object being cloned has the following members (among others):

  • Foos : List
  • FooArray : Foo[]
  • Ints : IEnumerable
  • IntArray: int[]

As you can see from the screenshot, the post-mapping, cloned object has its FooArray elements and Ints properties copied, instead of mapped - that is, the values from the source object are being used directly instead of being cloned.

2016-11-29 mapster cloning

Cheers,

Steve

@chaowlert
Copy link
Collaborator

for foo.FooArray[0] == foo.Adapt<Foo>().FooArray[0], this cannot reproduce in current source. But it can be reproduced from latest package. I dig into history, this had been fixed since August, but it might not yet been published. (sorry for this)

For IEnumerable<int>, I intentional reuse the same object (for enumerable of primitive) just because I think that IEnumerable is readonly by type definition. Originally, I built Mapster for mapping poco to dto only. But this test case is valid, I will fix this. Thank you.

@SteveWilkes
Copy link
Author

No problems :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants