Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 16, 2026

All DTOs were mutable classes. Converted to immutable records for value semantics, compile-time safety, and reduced boilerplate.

Changes

Response DTOs → Positional records:

// Before
public class ItemResponseDto
{
    public Guid Id { get; set; }
    public required string Sku { get; set; }
    public required string Description { get; set; }
    public bool IsActive { get; set; }
}

// After
public record ItemResponseDto(Guid Id, string Sku, string Description, bool IsActive);

Post DTOs → Nominal records with init:

// Before
public class PostItemDto
{
    public required string Sku { get; set; }
    // ...
}

// After
public record PostItemDto
{
    public required string Sku { get; init; }
    // ...
}

Maintained mutable set on service-populated fields (Id, DateCreated, CreatedBy) to preserve existing service layer patterns.

DTOs converted

  • CustomerResponseDto, PostCustomerDto
  • VendorResponseDto, PostVendorDto
  • ItemResponseDto, PostItemDto
  • AuthenticationResponse (already record)

Updated explicit conversion operators, example files, and tests to use positional syntax and immutable initialization patterns.

Original prompt

This section details on the original issue you should resolve

<issue_title>DTOs should be immutable record types instead of classes.</issue_title>
<issue_description></issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 3 commits January 16, 2026 06:30
Co-authored-by: CSharpFiasco <40156600+CSharpFiasco@users.noreply.github.com>
Co-authored-by: CSharpFiasco <40156600+CSharpFiasco@users.noreply.github.com>
Co-authored-by: CSharpFiasco <40156600+CSharpFiasco@users.noreply.github.com>
Copilot AI changed the title [WIP] Update DTOs to be immutable record types Convert DTOs to immutable record types Jan 16, 2026
Copilot AI requested a review from CSharpFiasco January 16, 2026 06:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DTOs should be immutable record types instead of classes.

2 participants