fullstackhero / dotnet-starter-kit

Production Grade Cloud-Ready .NET 8 Starter Kit (Web API + Blazor Client) with Multitenancy Support, and Clean/Modular Architecture that saves roughly 200+ Development Hours! All Batteries Included.
https://fullstackhero.net/dotnet-webapi-boilerplate/
MIT License
5.19k stars 1.56k forks source link

Add Mapster support for object mappings #64

Closed ittyabrehman closed 3 years ago

ittyabrehman commented 3 years ago

Please add the Mapster for object mapping as it is much efficient on both speed and memory. We could gain a 4x performance improvement while using only 1/3 of memory. we don't need to write our own DTO classes. Mapster provides Mapster. Tool to help us generating models. And if we would like to have explicit mapping, Mapster also generates a mapper class for us.

Mapster Repository URL: https://github.com/MapsterMapper/Mapster

cetindogu commented 3 years ago

This library is popular, nowadays

iammukeshm commented 3 years ago

Could you implement the same and raise a PR?

ittyabrehman commented 3 years ago

@iammukeshm Sure, i will add and raise the PR soon

dsoltesz commented 3 years ago

How is this different than automapper


From: itttyab Rehman @.> Sent: Tuesday, September 21, 2021 5:41:26 AM To: fullstackhero/dotnet-webapi-boilerplate @.> Cc: Subscribed @.***> Subject: Re: [fullstackhero/dotnet-webapi-boilerplate] Add Mapster support for object mappings (#64)

@iammukeshmhttps://github.com/iammukeshm Sure, i will add and raise the PR soon

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/fullstackhero/dotnet-webapi-boilerplate/issues/64#issuecomment-923810863, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AALFFSJPDYJRKRFUYHHSZW3UDBHMNANCNFSM5ENK2OPA.

ittyabrehman commented 3 years ago

@dsoltesz First of all thank you for asking the question. The real advantage of using Mapster is its performance and efficient memory usage. It is almost 2.5 times faster than AutoMapper. And twice as fast as the other known mapper's frameworks. In addition to this Mapster automatically generate the dtos which save a lot of time when working on a big codebase

You can see the results of a test run below

image

Source: screenshot taken from Mapster official repository:

iammukeshm commented 3 years ago

Let's skip the part where mapster creates it's own DTOs..Let's have our DTOs...we will just use Mapster for mapping the object, and replace Automappr implementation..Is that ok? @ittyabrehman

ittyabrehman commented 3 years ago

instead of replacing automapper i think we should declare a property in appSettings which will represent either to use automapper or mapster for mapping objects. what you say @iammukeshm

iammukeshm commented 3 years ago

Yes, we can do as the second step though...i will create an abstraction over the mapping later.

ittyabrehman commented 3 years ago

66 Added and merged Successfully