Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Property not Getting Mapped #771

Open
IPdotSetAF opened this issue Feb 2, 2025 · 2 comments
Open

Property not Getting Mapped #771

IPdotSetAF opened this issue Feb 2, 2025 · 2 comments
Assignees
Labels

Comments

@IPdotSetAF
Copy link

IPdotSetAF commented Feb 2, 2025

Hey, there.
I encountered an strange mapping bug, i am literally mapping from the same type to itself but an specific nested property gets null (Order.Payment.CVV)

here is the code:

public record CreateOrderRequest(OrderDTO Order);

public record CreateOrderCommand(OrderDTO Order) ;

public record OrderDTO
    (
    Guid Id,
    Guid CustomerId,
    string OrderName,
    AddressDTO ShippingAddress,
    AddressDTO BillingAddress,
    PaymentDTO Payment,
    OrderStatus Status,
    List<OrderItemDTO> OrderItems
    );

public record PaymentDTO
    (
    string CardName,
    string CardNumber,
    string Expiration,
    string CVV,
    int PaymentMethod
    );

public void test(CreateOrderRequest request)
        {
            var tmp = request.Adapt<CreateOrderCommand>();
        }

Mapster Version: 7.4.0
.Net Version: 8

PS. I have debugged the code and the CVV field does have a value before mapping

@DocSvartz DocSvartz added the bug label Feb 2, 2025
@DocSvartz
Copy link

@IPdotSetAF yes, i hope it wil be fix in the next release.
this setting should help you


 TypeAdapterConfig<PaymentDTO, PaymentDTO>
     .NewConfig()
     .NameMatchingStrategy(NameMatchingStrategy.IgnoreCase)


@DocSvartz DocSvartz self-assigned this Feb 2, 2025
@IPdotSetAF
Copy link
Author

Thanks @DocSvartz for the fast reply and recommendation.
I would also like to start contributing in the project. if there was any chance feel free to mention me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants