question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Properties that contain capitalized abbreviations cannot also be mapped in the fluent API when mapping to a record

See original GitHub issue

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 for HdmaReasons. 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))

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
andreravcommented, Mar 7, 2023

@ventii Yes this is a known issue, the name matching strategy does not seem to be working as intended.

0reactions
andreravcommented, Mar 7, 2023

See also #388.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Fluent API - Configuring and Mapping Properties and Types
When working with Entity Framework Code First the default behavior is to map your POCO classes to tables using a set of conventions...
Read more >
EF Code First prevent property mapping with Fluent API
Have you overridden DbContext.OnModelCreating yet? Does modelBuilder.Entity<Product>().Ignore(p => p.AddressDetails.Country) in that method ...
Read more >
RDA Refreshers: Capitalization, Abbreviations, Numbers
“Apply the instructions on capitalization in appendix A”. ... Note: The “cm” used to record the dimensions (i.e., 300 $c) is a symbol,...
Read more >
Hibernate ORM 6.0.0.CR1 User Guide
Hibernate not only takes care of the mapping from Java classes to database tables (and from Java data types to SQL data types),...
Read more >
Configure Property Mappings using Fluent API in EF Code- ...
The Fluent API can be used to configure properties of an entity to map it with a db column. Using Fluent API, you...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found