I have a source model that looks like this:
public class FooBar {
public Foo foo {get;set;}
public Bar bar {get;set;|
}
public class Foo {
// tons of properties
}
public class Bar {
// tons of irrelevant properties
public Baz baz {get;set;}
}
Then I have a destination model that flattens FooBar into NewFooBar and looks like this:
public class NewFooBar {
// all properties from Foo
public Baz baz {get;set;}
}
How can I map FooBar to NewFooBar without having to individually map all of foo’s properties? (there are many of them).
My first solution was to Map Foo and Bar seperately to NewFooBar, and that works. Then perform the maps individually. But this seems kludgy. I’d rather do it in a single mapping if possible. Am I missing some simple way to do this?
Would this work?
and then