我在实施AutoMapper 9.0时遇到了困难,无法弄清我所缺少的内容,因此将不胜感激。 c#.net框架。 我认为这是我的Profile类的外观。
public class AmProfile : Profile
{
public AmProfile()
{
CreateMap<Inventory,InventorymDto>(MemberList.None);
}
}
这是我认为需要放入应用程序开始类中的内容。
static void Main(string[] args)
{
var config = new MapperConfiguration(cfg =>
{
cfg.AddProfile<AmProfile>();
});
}
如何在应用程序中使用他进行映射。这与我在早期版本中使用AutoMapper的方式非常不同,因此我不确定哪一部分不正确。