Skip to content

MapDynamic with array property always results in a single-member array #57

@FilipFilipov

Description

@FilipFilipov

You can reproduce this easily in your MapDynamicTests if you change the Customer's Order type from ICollection<Order> to Order[] and then try to map a customer with more than one Order. The resulting array will always contain only the final Order.

Looking through the code I think this is caused by the MapCollection method, which for arrays does

var arrayList = new ArrayList { instanceToAddToCollectionInstance };

or in the case where isNewlyCreatedInstance is false

var arrayList = new ArrayList((ICollection)instance);

In both cases shouldn't that instead be

var arrayList = new ArrayList((ICollection)instance) { instanceToAddToCollectionInstance };

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions