Mapster icon indicating copy to clipboard operation
Mapster copied to clipboard

when leves proertiy is same name,its exception

Open baij45 opened this issue 1 year ago • 0 comments

public class User
{
    public string name { set; get; }
}

publicclass Bai
{
    public string code { get; set; }
}

publicclass People
{
    public Bai name { get; set; }
}

    User user = new User();
    user.name = "bai";
    TypeAdapterConfig<User, People>.NewConfig().Map(dest => dest.name.code, src => src.name);

    People p = user.Adapt<People>();

System.InvalidCastException:“From“System.String”To“DXApplicationTest.dto.Bai”Invalid cast。” it is same name with User.name and People.name,but it is not same class。how to fix this issue?

baij45 avatar May 13 '24 13:05 baij45