这是我的模特:
public class Testing: Model
{
public IEnumerable<Entry> Entries { get; set; }
}
public class Entry
{
public string testa{ get; set; }
public string testb{ get; set; }
public string testc{ get; set; }
public string testd{ get; set; }
public string teste{ get; set; }
public string testf{ get; set; }
public string testg{ get; set; }
public string testh{ get; set; }
}
继承人:
public TestingMapper()
{
Mapper.CreateMap<Testing, DisplayForm>()
.ForMember(dest => dest.Entries, opt => opt.MapFrom(source => source.Entries));
}
这是DisplayForm
public partial class DisplayForm
{
public DisplayForm()
{
InitializeComponent();
}
public IEnumerable<Entry> Entries
{
get
{
return null;
}
set
{
worklist1.DataBind(value);
}
}
}
但是我收到错误:AutoMapper.dll中发生'AutoMapper.AutoMapperMappingException'但未在用户代码中处理
尝试进行映射时。
我做错了什么?