How can I write a config to source generate a mapper from IReadOnlyCollection<POCO> to IReadOnlyCollection<DTO> using Mapster?
I have tried doing the following but it does not work.
public class MapsterConfiguration : IRegister
{
public void Register(TypeAdapterConfig config)
{
config.NewConfig<IReadOnlyCollection<POCO>, IReadOnlyCollection<DTO>>()
.GenerateMapper(MapType.Map | MapType.MapToTarget);
}
}
but if I use IReadOnlyCollection as a property, it works
public class CollectionDTO
{
public IReadOnlyCollection<DTO> MyProperty { get; set; }
}
config.NewConfig<CollectionPOCO, CollectionDTO>()
.GenerateMapper(MapType.Map | MapType.MapToTarget);