A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/MapsterMapper/Mapster/issues/281 below:

When mapping inner object to nullable property got property default value instead of null when the inner object is null · Issue #281 · MapsterMapper/Mapster · GitHub

When mapping inner object to nullable property got property default value instead of null when the inner object is null

Example:

class Program
    {
        static void Main(string[] args)
        {
            var result = new Child().Adapt<ChildResource>();
            Console.WriteLine(result.ParentId); //result.ParentId should be null not empty Guid
        }
    }


    public class Parent
    {
        public Guid Id { get; set; }
    }

    public class Child
    {
        public Guid Id { get; set; }
        public Parent Parent { get; set; }
    }

    public class ChildResource
    {
        public Guid Id { get; set; }
        public Guid? ParentId { get; set; }

    }


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4