سؤال

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.

هل كانت مفيدة؟

المحلول

AutoMapper is exactly what you want.

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

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top