I've got the following models:
public abstract class PersonBase : EntityWithTypedId
{
public PersonBase()
{
this.ProfileImages = new List<ProfileImage>();
}
public string name;
[Required]
public string Name
{
get { return name; }
set
{
name = value;
this.UrlFriendlyName = value.ToUrlFriendly();
}
}
public string UrlFriendlyName { get; protected set; }
[UIHint("UploadImage")]
public List<ProfileImage> ProfileImages { get; set; }
}
public class ProfileImage
{
public int PersonId { get; set; }
public byte[] Image { get; set; }
}
And my viewmodel:
public class PersonDetailsViewModel
{
public string Name { get; set; }
public IEnumerable<HttpPostedFilebase> ProfileImages { get; set; }
}
Now my question is, how can I map those with automapper? I mean the ProfileImage also needs the PersonId (which could be inserted by the Entity Framework on insert). Do I need to change the naming in the ViewModel or?