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
Using Mapster 7,2,0, when mapping to an interface with both readonly and writeable properties results in readonly properties assigned default values. Mapping to an interface with readonly properties only results in readonly properties being populated with values from the source, e.g.
public interface ITarget // GetOnlyProperty will be assigned value from source
{
int GetOnlyProperty {get;}
}
public interface ITargetWithGetSetProperties // GetOnlyProperty will be 0, GetSetProperty will be assigned value from source
{
int GetOnlyProperty {get;}
int GetSetProperty {get;set;}
}
The text was updated successfully, but these errors were encountered:
andrei-traktatovich
changed the title
Enable mapping to get-only properties of an interface
Non-unform mapping to get-only properties of a target interface
Sep 16, 2021
Seems like this behavior was introduced by this commit
In my opinion, properties should be mapped regardless of whether an interface is completely "readonly" or not. Isn't a "readonly" interface simply an edge case of an interface which happens to lack writeable properties?
Using Mapster 7,2,0, when mapping to an interface with both readonly and writeable properties results in readonly properties assigned default values. Mapping to an interface with readonly properties only results in readonly properties being populated with values from the source, e.g.
The text was updated successfully, but these errors were encountered: