-
Notifications
You must be signed in to change notification settings - Fork 333
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
Properties that contain capitalized abbreviations cannot also be mapped in the fluent API when mapping to a record #370
Comments
Might be related to #388. |
@CerebralUnit could you provide the models used for the issue? And please clarify if the specific problem only occurs when mapping to a constructor. |
Had the exact same issue - fields with consecutive capital letters in a C# record constructor are not mapped even when the source record/class has the same field with the same name. non working example:
got it to work by doing the following changes:
I was going crazy as I initially thought it was some bug with DateTime. Is this a known issue please? |
@ventii Yes this is a known issue, the name matching strategy does not seem to be working as intended. |
See also #388. |
…properly between records
…properly between records
…properly between records
…properly between records
Fix #370 where capitalized abbreviations are not mapped …
I solved my issue using the following code line; globalSettings.Default.NameMatchingStrategy(NameMatchingStrategy.Flexible); Mapster 7.4.0 Hope this helps. |
|
There are several properties in the Adverse record on the domain model that have abbreviations and are therefore capitalized (e.g.
HDMAReasons.
) Regardless of the naming strategy Exact, IgnoreCase, Flexible etc.. Mapster will fail execute a custom mapping unless a Pascal case version of the property is passed in for the destination object. Using x => x.HDMAReasons causes the mapper to throw a configuration error saying that there is neither a mapping nor an Ignore forHdmaReasons.
Neither object being mapped has that casing. Example of the code that finally worked below.config.MapDependentTo<Adverse, Domain.Adverse>()
.MapToConstructor(true)
.NameMatchingStrategy(NameMatchingStrategy.IgnoreCase)
.Map("HmdaReasons", src => src.HMDAReasons.Select(x => x.EnumValue))
The text was updated successfully, but these errors were encountered: