Our great sponsors
-
InfluxDB
Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
My recommendation is just to write the boilerplate mapping code yourself. Yes it's annoying, but it's also simple and obvious. The alternative is to use something like AutoMapper. In my experience though, this sort of magical reflection based solution causes more problems than it's worth. It makes the happy path of copying properties from one object to another wholesale much less verbose, but as soon as you need more complicated mappings the configuration quickly gets gnarly and hard to reason about. Any time saved manually typing out mapping code will be lost diagnosing runtime errors when converting between domain objects and DTOs.