Skip to content

Support mapping nested object properties directly from mapping function parameters #1719

Description

@TeckTn

related #1472

I would like to request a feature. Specifically, I would like it to support mapping nested objects properties directly from mapping function parameters.

For example, consider the following scenario:

public class ParentDto
{
    public required ChildDto Child { get; set; }
}

public class ChildDto
{
    public required string Name { get; set; }
}


public class ParentDomain
{
    public required string Id {get; init;}
    public required ChildDomain Child { get; set; }
}

public class ChildDomain
{
    public required string Id {get; init;}
    public required string Name { get; set; }
}

I want enabling this mapping scénario :

public static partial class Mapper
{

    [MapPropertyFromParameter(nameof(ParentDomain.Id), "parentId"]
    [MapPropertyFromParameter(nameof(ParentDomain.Child.Id), "childId"]
    public static partial ParentDomain ToDomain(this ParentDto parent, string parentId, string childId);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions