Mappa v10.1.0
From the portfolio: Mappa
A new version of Mappa (v10.1.0) has been released.
Mappa 10.1.0 builds on the 10.0.0 foundation with expanded enum mapping, richer parse and format MappaSettings, identity deep-copy and collection buffer options, stronger diagnostics, safer generated code, and a migrated test stack. Documentation now includes a full feature catalog.
Full changelog: v10.0.0…v10.1.0
Breaking changes
When upgrading from 10.0.0, see the upgrade guide.
MappaSettings rename
-
ForceCaseInsensitivePropertyMaprenamed toCaseInsensitivePropertyMap(#257, #260)- Update attribute usage:
[MappaSettings(CaseInsensitivePropertyMap = BooleanSetting.Enable)] - Update
.editorconfig:mappa.caseinsensitivepropertymap = enable - The legacy
.editorconfigkeymappa.forcecaseinsensitivepropertymapis no longer supported
- Update attribute usage:
Stricter diagnostics
Projects that previously compiled may now fail with new or tightened generator errors:
-
MP00042 — ambiguous invoke-method resolution (#233, #266) — When multiple methods match
[MappaInvokeMethod]or a polymorphismInvokeMethoddefault, the generator reports an error instead of silently selecting the first match. -
MP00038 — invalid parse style values (#231, #241) — Arbitrary integer
DateTimeStyles/NumberStylesvalues in[MappaSettings]now produce a generator diagnostic instead of being silently decomposed into known flag bits.
What’s new
Test infrastructure
- Migrate to xUnit v3 (#119, #222) — Test projects now use xUnit v3 and Microsoft Testing Platform.
- Replace FluentAssertions with AwesomeAssertions (#208, #223) — Assertion library updated across all test projects.
New features
-
IdentityMapDeepCopysetting (#14, #267) — Control shallow, deep, and nested same-type copying in identity mappings via[MappaSettings]. -
EnumerableConcreteTypesetting (#29, #268) — PreferT[]overList<T>when mapping to sequence-like interface targets (e.g.IEnumerable<T>). -
DateTimeStylefor parse (#214, #224) — Per-typeDateTimeStylesforParse/ParseExactonDateTime,DateOnly, andTimeOnly. -
NumberStylesfor parse (#215, #226) — Per-typeNumberStylesfor string-to-numericParseconversions. -
GlobalDateTimeStyleandGlobalNumberStyle(#225, #228) — Shared parse-style defaults applied across date/time and numeric types.
Enum mapping
-
Descriptionattribute support (#15, #16, #265) — Map enums using[Description]for enum-to-string, string-to-enum, and enum-to-enum conversions. - Case-insensitive string-to-enum (#17, #258) — Optional case-insensitive matching when parsing strings to enums.
-
Numeric enum-to-enum mapping (#18, #264) — Map enums by numeric value instead of member name via
EnumToEnumMapSetting. - Partial enum-to-enum warning (MP00039) (#19, #244) — Warn when not all source enum members can be mapped to the target enum.
-
CaseInsensitiveEnumMap(#15, #265) — Optional case-insensitive enum member matching. -
Rename
ForceCaseInsensitivePropertyMap(#257, #260) — Setting renamed toCaseInsensitivePropertyMap; legacy.editorconfigkey removed.
[MappaInvokeMethod] attribute
-
Optional
SourcePropertyNameparameter (#67, #243) — Invoke a method with an explicit source property value instead of the full source object. -
Ambiguous invoke-method diagnostic (MP00042) (#233, #266) — Report a diagnostic when
[MappaInvokeMethod]or polymorphism invoke-method resolution is ambiguous.
Diagnostics and quality
-
Invalid style values (MP00038) (#231, #241) — Diagnose arbitrary integer
DateTimeStyles/NumberStylesvalues in[MappaSettings]. - Test coverage improvements (#220, #239) — Additional generator, builder, and settings-stack tests for previously uncovered paths.
-
Fix
.editorconfigCurrentCulturemapping (#229, #235) — Correct global culture resolution inMappaGlobalOptions. -
Rename misleading local in
CanMapStringToNumber(#234, #242) — Internal readability fix in string strategy detection.
Generated code safety
- Escape format and culture strings (#230, #236) — User-controlled format and culture strings are safely escaped in generated mapping code.
- Escape attribute string literals (#232, #237) — User-controlled literals from mapping attributes are escaped in generated code.
Documentation and samples
-
Feature catalog (
Documentation/features.md) (#262, #263) — New page listing all Mappa features with links to tutorial, attributes, algorithm, and samples. - Generator algorithm documentation alignment (#227, #240) — Algorithm docs and generator README brought in line with the current implementation.
-
Suppress MP00039 in
EnumToEnumMappersample (#259, #261) — Intentional partial enum mapping demonstrated with#pragma warning disable.
What’s next
This is a tentative and non-exhaustive list of issues that I would like to cover in the upcoming version of Mappa:
Mapping / generator features
- #255 — Richer enum mapping configuration
- #250 — Before / after map hooks
- #249 — Circular reference / reference handling
- #248 — Generic mapping methods
- #246 — Reverse / bidirectional mapping
-
#245 — IQueryable projection (
ProjectTo) - #184 — More relaxed nullability when matching methods
- #120 — Flattening and unflattening
-
#108 — Allow preventing
Enumerable.Countwhen targeting arrays,Span, andMemory - #73 — Support fields, not only properties
-
#34 — Allow choosing
.Addvs. the indexer for dictionary-to-dictionary mapping
Language / platform
- #174 — Support C# 14 extension blocks in static classes (partial classes assumed)