Skip to content

Property not Getting Mapped #771

Open
@IPdotSetAF

Description

@IPdotSetAF

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions