An object to object mapping generator using Roslyn source generators.
$ dotnet add package MappingSourceGeneratorThis project has source generator that allows to generate constructor mappings without any business logic. Main use case is considered to be immutable models (records).
| Package | NuGet |
|---|---|
| MappingSourceGenerator |
List<T> and any interface implemented by them)For examples please check out src/MappingSourceGenerator.IntegrationTests project.
<PackageReference Include="MappingSourceGenerator" Version="0.1.12" PrivateAssets="all" ExcludeAssets="runtime" />
static partial method marked with MappingSourceGenerator.Markers.GenerateMappingAttribute in static partial class.public static partial class Mapper
{
[GenerateMapping]
public static partial Person2 Map(this Person1 person1);
}
Feel free to create issues for bugs or feature requests. General improvement suggestions (e.g. regarding tests) are appreciated.