Skip to content

[AllArgsConstructor] with inheritance #60

@daaa57150

Description

@daaa57150

Is your feature request related to a problem? Please describe.
Hi, I was trying to add the [AllArgsConstructor] to a class inheriting another, and the constructor generated only uses the current class' properties. Is this expected ?

Describe the solution you'd like
The corresponding properties of the base class should be included in the constructor, or at least have a flag parameter ?

Describe alternatives you've considered
None, just write the constructors myself in this particular case.

Additional context
Here is the code that fails to generate what I was expecting

[AllArgsConstructor(MemberType = MemberType.Property, AccessTypes = AccessTypes.Public)]
public partial class BaseModel
{
    public string Number { get; set; }
    public string Label { get; set; }
}

[AllArgsConstructor(MemberType = MemberType.Property, AccessTypes = AccessTypes.Public)]
public partial class ExtendedModel : BaseModel
{
    public string? Summary { get; set; }
    public string? Result{ get; set; }
}

The generated code is:

public partial class ExtendedModel
{
    public ExtendedModel (string? summary, string? result)
    {
        this.Summary = summary;
        this.Result = result;
    }
}

I would expect a constructor with 4 parameters, optionally calling base() with the parameters of the base class.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions