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 4 years ago • 0 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