Skip to content

Analyze replacing custom mapping extension method with AutoMapper #69

Closed
@nanotaboada

Description

@nanotaboada

Description

Analyze the potential benefits of replacing custom object mapping logic with AutoMapper, a popular library that reduces the need for boilerplate mapping code and improves maintainability.

https://github.com/nanotaboada/Dotnet.Samples.AspNetCore.WebApi/blob/master/Dotnet.Samples.AspNetCore.WebApi/Utilities/PlayerDataExtensions.cs

/// <summary>
/// Simple extension method to map all properties of a Player
/// </summary>
public static void MapFrom(this Player target, Player source)
{
    target.FirstName = source.FirstName;
    target.MiddleName = source.MiddleName;
    target.LastName = source.LastName;
    target.DateOfBirth = source.DateOfBirth;
    target.SquadNumber = source.SquadNumber;
    target.Position = source.Position;
    target.Team = source.Team;
    target.League = source.League;
    target.Starting11 = source.Starting11;
}

Acceptance Criteria

  • Review current object mapping code.
  • Integrate AutoMapper to handle object mappings.
  • Ensure that Data Transfer Objects (DTOs) are properly used with AutoMapper.
  • Test the mappings for correctness.

Resources

Metadata

Metadata

Assignees

No one assigned

    Labels

    .NETPull requests that update .NET codeenhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions