Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class EmbeddedInBar
- {
- public string Name { get; get; }
- public IEnumerable<int> ListOfInts { get; set; }
- }
- public class Bar
- {
- public int Id { get; set; }
- public string Name { get; set; }
- public IEnumerable<int> ListOfInts { get; set; }
- public EmbeddedInBar Embedded { get; set; }
- }
- var destination = new Bar
- {
- Id = 1,
- Name = "Destination",
- ListOfInts = new List<int>( 1,2,3 },
- Embedded = new EmbeddedInBar
- {
- Name = "DestinationEmbedded",
- ListOfInts = new List<int>( 4,5 }
- }
- };
- var source = new Bar
- {
- Id = 2,
- Name = "Source",
- ListOfInts = new List<int>( 6,7,8 },
- Embedded = new EmbeddedInBar
- {
- Name = "SourceEmbedded",
- ListOfInts = new List<int>( 9,10 }
- }
- };
- destination = Mapper.Map(source, destination);
- {
- Id: 2,
- Name: "Source",
- ListOfInts: [ 1,2,3,6,7,8 ]
- Embedded: {
- Name: "SourceEmbedded",
- ListOfInts: [ 4,5,9,10 ]
- }
- }
- {
- Id: 2,
- Name: "Source",
- ListOfInts: [ 6,7,8 ]
- Embedded: {
- Name: "SourceEmbedded",
- ListOfInts: [ 9,10 ]
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement