Hi,
after upgrading Mapster from v7 to v10, I noticed a behavior change that used to work for us without explicit custom mapping.
What changed
We have a destination/view model property like:
public int CasesCount { get; set; }
and a source entity with a collection:
public ICollection<Case> Cases { get; set; }
In Mapster v7, CasesCount was populated automatically (effectively from Cases.Count) even without any explicit .Map(...) configuration.
After upgrading to v10, the same property now gets value 0.
Question
Was this behavior intentionally changed in v10?
- If yes, was it ever officially supported, or was it only incidental behavior?
- If no, could this be a regression?
Minimal example
public class Source
{
public ICollection<Case> Cases { get; set; } = new List<Case>
{
new Case(),
new Case(),
new Case()
};
}
public class Case
{
}
public class Destination
{
public int CasesCount { get; set; }
}
Expected: CasesCount == 3
Actual: CasesCount == 0
Hi,
after upgrading Mapster from v7 to v10, I noticed a behavior change that used to work for us without explicit custom mapping.
What changed
We have a destination/view model property like:
and a source entity with a collection:
In Mapster v7,
CasesCountwas populated automatically (effectively from Cases.Count) even without any explicit .Map(...) configuration.After upgrading to v10, the same property now gets value 0.
Question
Was this behavior intentionally changed in v10?
Minimal example
Expected:
CasesCount == 3Actual:
CasesCount == 0