I'm trying to map with AutoMapper
I have this model from data:
public partial class ModelFromData
{
public int Id { get; set; }
public int LastPosition { get; set; }
public virtual SomeModel SomeModel{ get; set; }
}
And my view Model
public class ViewModel
{
public int Id { get; set; }
public int LastPosition { get; set; }
public virtual SomeModel SomeModel{ get; set; }
}
My Mapper configures:
public class MapperConfig
{
public static void InitMaps()
{
Mapper.CreateMap<ModelFromData, ViewModel>();
Mapper.CreateMap<ViewModel, ModelFromData>();
Mapper.AssertConfigurationIsValid();
}
}
public static class MapExtensions
{
public static T To<T>(this Object from)
{
return Mapper.Map<T>(from);
}
}
When I try to AutoMap I get the folowing error:
Missing type map configuration or unsupported mapping.
Mapping types: ModelFromData -> ViewModel
enter code here
Project.Data.ModelFromData -> Project.Web.Models.ViewModel