I have two models:
public class LocationMasterModel()
{
public int LocationId { get; set; }
public int OtherAddressId { get; set; }
public OtherAddress OtherAddress { get; set; }
}
public class OtherAddress()
{
public int OtherAddressId { get; set; }
public int LocationId { get; set; }
public LocationMasterModel LocationMaster { get; set; }
}
AutoMapper:
Mapper.CreateMap<LocationMasterModel, LocationMasterViewModel>();
LocationMasterViewModel
is another class that is just used for viewing purposes.
So when I try to get the location from my repository and try to convert from LocationMasterModel
to LocationMasterViewModel
, I need to stop the reference looping after one level of the hierarchy.