How do you guys create DTOs?
02:41 11 Mar 2026

I am new to asp.net coming from a django-nestjs background. I haven't found complete resources that explain how to use DTOs. Should I use AutoMapper or Mapster? I have heard some say you shouldn't use AutoMapper with some reasons. Should i do things manually? And how would I go about doing it? Is the following good to use:

public abstract class BaseEntity
{
    public long Id { get; set; }
    public DateTime CreatedAt { get; set; }
    public DateTime UpdatedAt { get; set; }
}

public class Post : BaseEntity
{
    public required string Body { get; set; }
    public List Comments { get; } = new();
}

public class PostCreateDto
{
    public required string Body { get; set; }
}

public class PostUpdateDto
{
    // partial update fields
}

// Here BaseResponseDto is similar BaseEntity with DateTime fields maybe?
public class PostResponseDto : BaseResponseDto
{
    public long Id { get; set; }
    public required string Body { get; set; }
    // DateTime fields inherited from BaseResponseDto?
}

Then there's the issue of mapping. Do you guys create your own implementation of mapping? What would it look like? Of course I am not supposed to map to dto in every service/controller method right?

asp.net-web-api objectmapper