我有此个人资料:
public class FooToBarProfile : Profile
{
public FooToBarProfile()
{
CreateMap<Foo, Bar>()
.ConstructUsing(x => new Bar())
.ForMember(d => d.Name, opt => opt.MapFrom(s => s.FirstName))
.ForMember(d => d.Baz, opt => opt.MapAtRuntime())
.AfterMap((src, dest, context) => dest.Baz = GetSomethingFromSomewhere());
}
}
当我验证配置时,我看到
Unmapped members were found. Review the types and members below.
Add a custom mapping expression, ignore, add a custom resolver, or modify the source/destination type
For no matching constructor, add a no-arg ctor, add optional arguments, or map all of the constructor parameters
===================================================================================================================================================
Foo -> Bar (Destination member list)
MyApp.Foo -> MyApp.Bar (Destination member list)
Unmapped properties:
Baz
我告诉AutoMapper我正在运行时映射它,为什么将它报告为未映射成员?