Skip to content

human-unidentified/riok-mapperly-examples

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Riok.Mapperly Examples

This repository contains a collection of examples demonstrating how to use Riok.Mapperly, a high-performance .NET source generator for object mapping.

Mapperly creates the mapping code at build time, which means there is no runtime overhead and the generated code is fully type-safe and trim-friendly.

Features Demonstrated

The examples in this repository cover several common mapping scenarios:

  • Basic Mapping: Simple object-to-object mapping where property names and types match. See SampleMapperTests.cs.
  • Properties with Different Names: Using the [MapProperty] attribute to map properties when names don't match. See PropertiesWithDifferentNamesTests.cs.
  • Enum Mapping: Customizing enum mapping using [MapEnum] and [MapEnumValue] to handle different naming strategies or specific value mappings. See EnumMapperTests.cs.
  • Custom Mapping Logic: Integrating manual mapping logic or sub-mappers for complex transformations. See MapperWithSubMapperTests.cs.

Prerequisites

Getting Started

To run the examples and verify the mappings, use the .NET CLI:

dotnet test

Project Structure

  • riok-mapperly-examples/: Contains the test project with all mapper definitions and examples.
    • SampleMapperTests.cs: Basic mapping example.
    • EnumMapperTests.cs: Enum mapping with strategies and value overrides.
    • PropertiesWithDifferentNamesTests.cs: Mapping between different property names.
    • MapperWithSubMapperTests.cs: Custom mapping methods.

Resources

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages