0

I have two classes, say ClassA and ClassB, and I want to map them with ClassC. How can I do it?

ClassA has only 1 property and ClassB has 5 properties. ClassC has 6 properties.

Situation is something as below:

Public ClassC MapRequest(classA id, ClassB someProperties){
    _mapper.Map<ClassC>(id);
    _mapper.Map<Classc>(someProperties);

    retrun type of ClassC;
}
Andrew Morton
  • 24,203
  • 9
  • 60
  • 84
Kapil Garg
  • 51
  • 1
  • 4

1 Answers1

-1

There is overload of Map method available.

var objClassC = _mapper.Map<ClassA, ClassC>(id);

// You need to pass above instance to next call.
_mapper.Map<ClassB, ClassC>(someProperties, objClassC );

Hope this helps.

Parag
  • 543
  • 1
  • 8
  • 18