Skip to content

Latest commit

 

History

History
62 lines (38 loc) · 3.69 KB

File metadata and controls

62 lines (38 loc) · 3.69 KB

Mammoth.LiteMapper

Mammoth.LiteMapper is a convention-first, compile-time object mapping library for C#.

Consumers declare partial mapping methods on classes marked with [LiteMapper]. A Roslyn incremental source generator emits direct C# implementations using constructors, assignments, loops, casts, and ordinary method calls. LiteMapper is not a runtime mapping container and does not provide runtime mapper registration, assembly scanning, reflection fallback, or dynamic dispatch.

Assembly-wide defaults and external mapper registrations are compile-time inputs. When they change, the incremental generator reevaluates affected generated mappings and diagnostics while preserving unrelated output where Roslyn can preserve its candidate identity.

Generated nested and collection helpers are private implementation details of each generated mapper. Their names are allocated deterministically within that mapper, reserve handwritten and other generated helper signatures, reuse names for identical closed source/destination pairs, and disambiguate distinct pairs without depending on syntax-tree order. Consumers must not depend on generated helper names or signatures.

Compilation Status

  • main CI
  • develop CI

Quickstart

Install the primary package:

<PackageReference Include="Mammoth.LiteMapper" />

Declare a mapper:

using Mammoth.LiteMapper;

[LiteMapper]
public static partial class CustomerMapper
{
    public static partial CustomerDto Map(Customer source);
}

Use the generated method like ordinary C#:

CustomerDto dto = CustomerMapper.Map(customer);

See the compiling samples under samples/ for static mappers, instance mappers, collections, recursive mappings, and ASP.NET Core usage.

Ordinary unmapped target members are reported as LITEMAPPER1001 errors by default. Explicit mapper or method UnmappedMemberPolicy values and standard compiler severity configuration may intentionally relax this configurable diagnostic; doing so preserves valid generation but is not proof of complete target coverage. Required, non-nullable, inaccessible, invalid, and otherwise mandatory target obligations remain hard errors. Projects requiring mandatory unmapped-target coverage should treat LITEMAPPER1001 as an error in CI and audit or avoid project-wide suppression.

Documentation

  • SPECIFICATION.md is the sole authoritative product contract.
  • USAGE.md is the usage guide and must stay synchronized with the specification, samples, tests, and other project documents.

Agent skill

The mammoth-litemapper skill provides consumer mapping guidance for compatible coding agents using the Skills CLI.

Once this skill is published on the repository's default branch, install it from your consuming project:

npx skills add PrimordialCode/Mammoth.LiteMapper --skill mammoth-litemapper

Append --agent codex to target Codex or --global for user-level installation. To preview this checkout's discoverable skills without installing, run npx skills add . --list from the repository root. The skill contains its own supporting reference; consumers do not need a LiteMapper source checkout. Local validation does not establish a skills.sh directory listing.