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
Adapt to existing object not work when have readonly property #984
voidMain(){vara1=newFoo(){Id=3,Name="aa"};vara2=newFoo(){Id=3};a1.Adapt(a2);a2.Name.Dump();// will got null}classFoo(){publicintId{get;set;}publicstringName{get;set;}publicstringProp{get;}//when have setter, no problem}
Activity
DocSvartz commentedon Jun 12, 2026
Hi @ahdung, Do you want to update the property value from readonly property?
ahdung commentedon Jun 12, 2026
no, the problem is readonly property cause entire a2 not get updated.
DocSvartz commentedon Jun 12, 2026
What version of Mapster?
ahdung commentedon Jun 12, 2026
10.0.7, latest release
DocSvartz commentedon Jun 12, 2026
This is a bug in defining immutable types. Use the latest pre-release version or register the type mapping to itself without any settings.
ahdung commentedon Jun 12, 2026
Thank you very much