A new version of Mappa (v10.0.0) has been released.

Mappa 10.0.0 is a major release. It targets .NET 10, adds polymorphic mapping and richer configuration, and expands MappaInvokeMethod, constructor mapping, and collection support. Documentation and samples were reviewed end-to-end. Full changelog: v1.2.0โ€ฆv10.0.0

Whatโ€™s new

Platform

  • Migrate to .NET 10 (#178, #188) โ€” Mappa now targets .NET 10; upgrade consuming projects accordingly.

New features

  • Polymorphic mapping (#49, #187) โ€” Map base types to derived instances when the runtime type is known.
  • MappaAssignToContext attribute (#205, #207) โ€” Assign mapped values into MappaContext during generation.
  • MappaSettings property name matching (#98, #211) โ€” Configure how source and target property names are matched (e.g. case sensitivity).
  • Constructor strategy: ignore target properties (#3, #204) โ€” Exclude specific target properties from constructor-based mapping via attribute.
  • String โ†’ Parse(string) mapping (#52, #177) โ€” Map string to any type that exposes static TTarget Parse(string).
  • Numeric format and IFormatProvider (#76, #216) โ€” Control culture and format for numeric Parse / ToString conversions.

[MappaInvokeMethod] attribute

  • MappaContext parameters (#70, #206) โ€” Invoked methods can accept MappaContext arguments.
  • Hierarchy lookup (#179, #199) โ€” Optional fields, properties, and methods are resolved up the class hierarchy.
  • Instance member access (#193, #195) โ€” Non-static fields and properties are referenced with this. in generated code.
  • Static vs. instance safety (#190, #194) โ€” A static mapping method cannot invoke a non-static method.
  • Non-static method dependencies (#185, #191) โ€” Method dependency lookup can use accessible non-static methods where appropriate.

Mapping improvements

  • Collection concrete types with capacity constructors (#109, #176) โ€” Support collection types that expose a capacity constructor.
  • Read-only collection properties (#110, #202) โ€” Broader support when targeting read-only properties of collection types.
  • Inherited mapping methods (#186, #196) โ€” Methods used for mapping are discovered in parent classes.
  • MappaDependency in base classes (#183, #197) โ€” Fields and properties marked with MappaDependency are picked up from accessible members in parent classes.

Diagnostics and quality

  • Missing attribute warnings (#154, #203) โ€” Additional compiler warnings for misconfigured or incomplete attribute usage.
  • EditorConfig integration tests for MappaSettings (#210, #213) โ€” Settings behavior is validated against EditorConfig configuration.

Documentation and samples

  • Tutorial and documentation review (#148, #217) โ€” Tutorial advanced topics, attribute reference, error codes, and package READMEs updated and aligned with current behavior.
  • MappaInvokeMethod docs for MappaContext (#209, #212) โ€” Documented rules for MappaContext in invoked methods.
  • AOT samples coverage (#41, #198) โ€” Mappa.Samples.Aot now runs all sample mappers for native/AOT validation.

Maintenance

  • CI and tooling (#200, #201) โ€” GitHub Actions dependencies bumped to current versions.
  • TODO hygiene (#182, #189) โ€” Guard against leftover issue TODOs in the codebase.

Whatโ€™s next

This is a tentative and non exhaustive list of issue that I would like to cover in the upocoming version of Mappa:

Mapping / generator features

  • #215 โ€” Support NumberStyles for Parse on all numeric types
  • #214 โ€” Support DateTimeStyle for Parse / ParseExact on DateTime, DateOnly, TimeOnly
  • #184 โ€” More relaxed nullability when matching methods
  • #181 โ€” Speed up enum mappings with switch expressions
  • #175 โ€” Support mapping empty โ†’ empty type
  • #155 โ€” Add MappaUseConstructor attribute to pick which constructor to use
  • #120 โ€” Allow mapping via nested source property chains
  • #73 โ€” Support fields, not only properties
  • #67 โ€” MappaInvokeMethodAttribute: add SourceProperty parameter
  • #29 โ€” Option to prefer arrays over lists in generated code
  • #19 โ€” Fail enumโ†’enum maps when not all source values are mappable

Language / platform

  • #174 โ€” Support C# 14 extension blocks in static classes (partial classes assumed)

Protobuf

  • #89 โ€” Polymorphism via protobuf oneof for both source and target

Testing / benchmarks / CI

  • #208 โ€” Migrate away from FluentAssertions
  • #119 โ€” Migrate to xUnit v3
  • #134 โ€” Improve benchmarks
  • #152 โ€” Run benchmarks on CI/CD when merging to main