We've run into an issue mapping a class to an interface using Mapster 7.2.0. Mapping to target interface
public interface ITarget
{
int GetOnlyProperty {get;}
int GetSetProperty {get;set;}
}
with source.Adapt<ITarget>()
always results in GetOnlyProperty
having the default value 0
.
However, if the target interface has all read-only properties, e.g.
public interface IReadonlyTarget
{
int GetOnlyProperty {get;}
int GetSetProperty {get;}
}
both GetOnlyProperty
and GetSetProperty
are set to the right values from the source.
Is this a bug or a feature, and if a feature, how can one make Mapster populate a target interface with both readonly and writeable target properties?