我有这些课程
public class NamedEntityViewModel
{
public string Name { get; set; }
}
public class NamedEntityListViewModel
{
public List<NamedEntityViewModel> List { get; set; }
}
public class Album : INamedEntity
{
public int Id { get; set; }
[Required]
public string Name { get; set; }
public virtual ICollection<Song> Songs { get; set; }
[Required]
public int AlbumNumber { get; set; }
}
我有一个List<Album>
,我想NamedEntityListViewModel
通过NamedEntityViewModel.Name
映射到 Album.Name 来映射它。如何在 Automapper 中进行设置?