You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Dal ToDto/FromDto share value lists (aliasIds, text) between POCO and DTO #428
The generated Dal conversions between POCO and DTO assign value lists by reference, so a POCO and the DTO converted from it share one List<string>. Changing the POCO afterwards silently changes every DTO converted from it before, and the other way round.
poco.AliasIds=dto.AliasIds;// line 61, FromDtodto.AliasIds=poco.AliasIds;// line 157, ToDto
The same pattern occurs in every conversion of aliasIds (167 metaclasses) and of the derived text (7). Reference lists are not affected: they are built fresh, e.g. poco.ownedMember.Select(x => x.Id).ToList().
Repro
varpackage=newPackage{AliasIds=["a"]};vardto=(SysML2.NET.Core.DTO.Kernel.Packages.Package)package.ToDto(false);package.AliasIds.Add("b");// dto.AliasIds is now ["a", "b"]
Impact
A DTO is a snapshot for transport or comparison, but it does not stay one. In the Flexo integration scenario of #407 (step 5), adding an alias to the root package also changed the DTO kept as the expected model of the previous commit:
the history check, which re-reads the package at that commit, then reported a false difference on Element.AliasIds;
a delta computed against that DTO would miss the change.
Fix
Copy value lists in both directions in the generator, e.g. dto.AliasIds = [.. poco.AliasIds];, and regenerate.
Activity
Fix #428: fix shared list issue
[Update] Flexo integration scenario: drop the #428 workaround in Mode…