我有财产模型:
public class MyModel{
public SelectList PropertyTypeList { get; set; }
}
我有 ValueResolver
public class MyPropertyValueResolver : ValueResolver<ProductProperty, SelectList>
{
protected override SelectList ResolveCore(ProductProperty source)
{
myList = .......;
return new SelectList(myList, "Value", "Text");
}
}
然后我配置映射
Mapper.CreateMap<Source, Destination>()
.ForMember(s => s.PropertyTypeList, opt => opt.ResolveUsing<MyPropertyValueResolver>());
但它告诉我
Type 'System.Web.Mvc.SelectList' does not have a default constructor
我应该怎么做才能让它工作?