I am using AutoMapper to map two objects. ViewModel and Model, where ViewModel Implements InotifyPropertyChanged. How can i map Model to ViewModel. Below is my scenario,
Model
public class Model { public string ResultType { get; set; } }
ViewModel
public class ViewModel : Screen { private string _resultType; public string ResultType { get { return _resultType; } set { _resultType = value; NotifyOfPropertyChange(() => ResultType); } } }
Create Map implementation
mapper.CreateMap<Model, ViewModel>(); mapper.CreateMap<ViewModel, Model>(); mapper.AssertConfigurationIsValid(); var test1 = new Model() {ResultType = "Test Result"}; var s1 = mapper.Map<ViewModel>(test1);
I get AutoMapper Mapping Exception when i call mapper.Map.
Missing type map configuration or unsupported mapping. Mapping types: Model-> ViewModel Support.Model -> Support.ViewModel