Domanda

In our architecture there are multiple layers and they speak different DTOs, so it common to translate objects with exactly the same properties.

What are the tools/techniques available which help with the laborious task of creating class A which looks like class B and objects of class A are created from objects of class B?

I'm after solutions which would allow me to generate this translating code. Keeping two objects always in sync is another issue :)

I have a Resharper license.

È stato utile?

Soluzione

AutoMapper is exactly what you want.

It allows you to setup mapping profiles that map between objects with similar/same properties.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top