The first time using AutoMapper, and it's hard for me to determine how to use it. I am trying to map the ViewModel to my database tables.
My ViewModel looks like this:
public class AddressEditViewModel
{
public AddressEdit GetOneAddressByDistrictGuid { get; private set; }
public IEnumerable<ZipCodeFind> GetZipCodes { get; private set; }
public AddressEditViewModel(AddressEdit editAddress, IEnumerable<ZipCodeFind> Zips)
{
this.GetOneAddressByDistrictGuid = editAddress;
this.GetZipCodes = Zips;
}
}
The mapping I'm trying to use is ...
CreateMap<Address, AddressEditViewModel>();
When I run this test ...
public void Should_map_dtos()
{
AutoMapperConfiguration.Configure();
Mapper.AssertConfigurationIsValid();
}
I get this error ...
AutoMapper.AutoMapperConfigurationException: the following 2 properties on JCIMS_MVC2.DomainModel.ViewModels.AddressEditViewModel are not displayed: GetOneAddressByDistrictGuid GetZipCodes Add your own display expression, ignore or rename the property in JCIMSAdMMC2.MVC.
I am not sure how I should display these 2 properties. I would be grateful for any direction. Thanks
Mark