给出了两个类:
public class ResultDto<TData>
{
public TData Data { get; set; }
public Dictionary<string, string> Errors { get; set; }
}
public class ResultAs<TResult>
{
public TResult? Value { get; set; }
public Dictionary<string, string>? ErrorParams { get; set; }
}
我想为泛型类编写映射配置。我以为它会像这样工作:
TypeAdapterConfig<ResultAs<object>, ResultDto<object>>
.NewConfig()
.Map(dest => dest.Data, src => src.Value)
.Map(dest => dest.Errors, src => src.ErrorParams);
但事实并非如此。