0
私は2つのエンティティEFクラスRegionとCountryを持っています。AutoMapperを使用してマップを作成する6.1.1
public class Region
{
public int Id { get; set; }
public string Name { get; set; }
public virtual ICollection<Country> Countries { get; set; }
}
public class Country
{
public int Id { get; set; }
public string Name { get; set; }
public int RegionId { get; set; } // FK
}
これらのエンティティを対応するViewModelにマップする必要があります。
public class RegionViewModel
{
public int Id { get; set; }
public string Name { get; set; }
public virtual ICollection<int> Countries { get; set; }
}
public class CountryViewModel
{
public int Id { get; set; }
public string Name { get; set; }
}
ただし、AutoMapper 6.1.1ではMapperにはCreateMapの定義が含まれていません。 Mapper.CreateMap<Regin, RegionViewModel>()
どうすれば解決できますか?