Reusing domain models more instead of always creating ViewModels/DTOs
We talk regularly about the different ways we have to do object-object mapping, AutoMapper in particular gets mentioned a fair bit here on r/dotnet. Couldn't a lot of these to/from mappings be avoided in the first place if we reused our domain models more?
Obviously there's a lot of cases where the domain models just won't fit for the use case but often we create huge amounts of ViewModels which are 100% identical to their corresponding domain models simply for reasons of 'separation of concerns'.
Are we missing a touch of balance or pragmatism here?
Is all this boilerplate really needed?
Well ... the meme summarizes it nicely perhaps 🤷🏻♂️
If there are no over-posting concerns and any extra data pulled back does not impact performance I'd very likely just reuse the domain models.
What about you?