Simple replacement for AutoMapper

AutoMapper is great library, but it introduces another dependency and requires configuration. I try to stick to convention and use the same names in DTOs and domain objects. That is why I decided to write simple Object extension methods. Usage is simple:

There are also some other useful functions:

Not a big thing, but I copy this code from one project to another from time to time.

And here is source code:

Comments

  1. The article presents a simple and practical alternative to using AutoMapper when DTOs and domain objects follow the same naming conventions. The idea of using object extension methods can reduce the need for an additional dependency and avoid configuration overhead, while still keeping the mapping approach straightforward. The examples and reusable source code make the solution easy to understand and potentially useful across multiple projects.

    I also like the author's focus on keeping commonly reused code simple rather than introducing unnecessary complexity. For developers building applications with .NET technologies, concepts such as object mapping, DTOs, domain models, and reusable extension methods are valuable parts of application development. A Dot Net Full Stack Training in Chennai can help developers build a broader understanding of these development practices.

    ReplyDelete
  2. The approach described here can be especially useful when a project has consistent naming conventions between its DTOs and domain objects. It demonstrates how a small reusable utility can solve a recurring development requirement without relying on a larger library. Developers working toward full-stack application development can also explore an ASP.NET Core Angular Full Stack Training in Chennai to gain wider exposure to .NET-based application development and related frontend technologies.

    ReplyDelete

Post a Comment

Popular posts from this blog

Entity Framework - dodawanie / import wielu rekordów naraz

Opinie na temat hostingu linuxpl.com

Creating CSR and PFX - for future reference