Skip to content

#nullable in [NoArgsConstructor] #62

@daaa57150

Description

@daaa57150

Is your feature request related to a problem? Please describe.
Our projects always use the nullable feature, but for some classes like the entities, we still need an empty constructor, so that Entity Framework can create them. This results in this code:

public class MyEntity: : Entity
{
    public string NonNullableProperty { get; set; }

#nullable disable warnings
    private MyEntity() { /* For EF Core */ }
#nullable enable warnings
}

I was hoping to use [NoArgsConstructor] to hide this mess, but the generated file enforces the #nullable enable, which makes Lombok.NET useless in this case.

Describe the solution you'd like
I'd like a way to build an empty constructor with #nullable disable, either with a parameter or another attribute.
[NoArgsConstructor(NullableDisable = true)]
[DeserializerConstructor] (whatever name you see fit)

Describe alternatives you've considered
Unfortunately I'll just have to keep the mess

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