Error mapping record types in version 11.0.0 - dotnet 6 #3877
freddyccix
started this conversation in
NA
Replies: 1 comment 1 reply
-
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I just upgrade my project from dotnet 5 to dotnet 6, and Automapper from version 8.1.1 to version 11.0.0, and found a minor problem mapping record types.
When I set TDestination as a record type using this form:
public record MyRecord(int Id);
Automatically uses the value of TSource with a matching name, for instance
public class MyEntity { public int Id {get; set;} ... other properties }
Bypassing my mapping profile completely which is setting the Id value to another property or a calculated value.
The only solution I´ve found was declaring TDestination in this form:
public record MyRecord { public int Id {get; init;} }
Or declare it as normal class.
Is this the expected behavior now? Or am I missing something?
Please let me know if you need more info
Thanks
Beta Was this translation helpful? Give feedback.
All reactions