I have two sub class that I need to copy a List element from into a master object
public Class Foo1 : Anote
{
public bool Ison { get; set;}
public List<Anote>Anotes { get; private set;}
public Foo1()
{
this.Anotes = new List<Anote>();
}
}
public Class Foo2 : Bnote
{
public bool Ison { get; set;}
public List<Bnote>Anotes { get; private set;}
public Foo2()
{
this.Anotes = new List<Bnote>();
}
}
public Class Foo3 : Cnote
{
public bool Ison { get; set;}
public List<Cnote>Anotes { get; private set;}
public List<Cnote>Bnotes { get; private set; }
}
I will be retreiving data from a database and putting this data into Foo1 and Foo2. I then need
to Map the List data from Foo1 and Foo2 into the List elements in Foo3.
I have done
Foo1A foo1a = new Foo1A();
Foo2A foo2a = new Foo2A();
Mapper.CreateMap<Foo1, Foo1A>();
Mapper.CreateMap<Foo2, Foo2A>();
Mapper.Map<Foo1, Foo2A>(foo1, foo1a);
Mapper.Map<Foo2, Foo2A>(foo2, foo2a);
and this works but what I need to do is
Map the List Anotes in Foo1 to the List Anotes in Foo3
Map the List Anotes in Foo2 to the List Bnotes in Foo3.
You should just be able to do:
foo3.ANotesandfoo3.BNotesshould both have been mapped correctly.