Mapster icon indicating copy to clipboard operation
Mapster copied to clipboard

Mapster.Tool does not translate Nullable ICollection in domain to a nullable ICollection in the generated class

Open scottcollins opened this issue 5 years ago • 1 comments

I have two domain classes

Friend.cs

    public record Friend
    {
        public string Name { get; init; }
    }

Me.cs

    public record Me
    {
        public string Name { get; init; } = null!;
        public Province Location { get; init; } = null!;
        public Company Job { get; init; } = null!;
        public ICollection<Friend>? Friends { get; init; }
    }

When MeDto.g.cs is generated, the Friends collection is not a nullable property

    public partial record MeDto
    {
        public string Name { get; set; }
        public ProvinceDto Location { get; set; }
        public CompanyDto Job { get; set; }
        public ICollection<FriendDto> Friends { get; set; }
    }

Code to reproduce the issue at

https://github.com/aurasolutions/mapster-issues.git

scottcollins avatar Jun 22 '21 04:06 scottcollins

In order to identify issues that are still active, we are closing issues that we believe are either resolved or are dormant. If your issue is still active then please reopen. Thanks.

stagep avatar Jan 07 '25 17:01 stagep