获取AutoMapper.dll中出现“AutoMapper.AutoMapperMappingException”类型的异常,但未在用户代码中处理

时间:2014-05-15 05:50:30

标签: c# automapper

这是我的模特:

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'但未在用户代码中处理

尝试进行映射时。

我做错了什么?

0 个答案:

没有答案