提问人:Richthofen 提问时间:11/16/2023 更新时间:11/16/2023 访问量:25
iOS 不支持 Automapper 的操作
Operation not supported on iOS for Automapper
问:
我正在使用自动映射器将 DTO 对象转换为 Xamarin iOS 中的另一个对象。我收到 iOS 不支持的反射错误。Dto 和 target 对象都有一个子对象的集合,这些子对象也在 Automapper 中映射。如果我忽略子对象集合,则不会收到错误,因此我知道该问题与尝试映射具有子属性的对象特别相关IEnumerable
System.TypeInitializationException:“AutoMapper.Execution.ProxyGenerator”的类型初始值设定项引发异常。---> System.PlatformNotSupportedException:此平台不支持操作。
//Mapper config for parent type, and then subtype
CreateMap<EditRequestDto, EditRequestGroup>()
.ForMember(x => x.Entries, opt => opt.MapFrom(y => y.DtoEntries))...
CreateMap<EntryDto, IEditEntry>()...
//Class definitions
public class EditRequestGroup: IEditRequestGroup
{
public IEnumerable<IEditEntry> Entries { get; set; }
...
这在 Android 上工作正常。我不确定为什么 iOS 必须在这里使用反射。
答: 暂无答案
评论