Arebis.ReMapper
0.8.6
dotnet add package Arebis.ReMapper --version 0.8.6
NuGet\Install-Package Arebis.ReMapper -Version 0.8.6
<PackageReference Include="Arebis.ReMapper" Version="0.8.6" />
paket add Arebis.ReMapper --version 0.8.6
#r "nuget: Arebis.ReMapper, 0.8.6"
// Install Arebis.ReMapper as a Cake Addin #addin nuget:?package=Arebis.ReMapper&version=0.8.6 // Install Arebis.ReMapper as a Cake Tool #tool nuget:?package=Arebis.ReMapper&version=0.8.6
Arebis ReMapper
This nuget is a C# Source Generator generating source code consisting of:
- Contract types or Data Transfer Object types.
- Mapper code to convert domain objects into contract objects.
- Reverse mapper code to convert contract objects back into domain objects.
Getting Started
- Install the Arebis.ReMapper nuget on the project where you want to generate contract types and/or mapper types. You can install the nuget on different projects.
- Create a ReMapper.xml file (the name does not matter, as long as it has a
.xml
extension). - Set the Build Action property of the ReMapper.xml file to
C# analyzer additional file
. - Write your mapping definition in the file.
Here is an example of a ReMapper.xml file:
<?xml version="1.0" encoding="utf-8" ?>
<ReMapper>
<Namespace Name=".Models" For="Example.WebShop.Domain">
<Using CopyAttributes="true">System.ComponentModel.DataAnnotations</Using>
<Types>
<Documentation/>
</Types>
<Mapper/>
<ReverseMapper CreateMethod="new" Conservative="true" />
<Type Name="CustomerModel" For="Customer" ReverseMap="CU">
<Property Name="Id" IsKey="true" />
<Property Name="Name" />
<Property Name="Address" />
</Type>
<Type Name="InvoiceModel" For="Invoice" ReverseMap="CU">
<Property Name="Id" IsKey="true" />
<Property Name="Date" />
<Property Name="Customer" Type="CustomerModel" />
</Type>
</Namespace>
</ReMapper>
The Arebis.ReMapper.X.Y.Z.nupkg
file contains a ReMapper.xsd
file to help you defining the mappings. However you will have to manually extract the .xsd
file as it is not installed in your project by default.
To generate persistent code files, add the following line to your .csproj
file:
<EmitCompilerGeneratedFiles>True</EmitCompilerGeneratedFiles>
For more about Source Generators in general, see: https://learn.microsoft.com/en-us/dotnet/csharp/roslyn-sdk/source-generators-overview
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
0.8.6 | 134 | 10/1/2024 |
0.8.5 | 102 | 10/1/2024 |
0.8.4 | 141 | 5/27/2024 |
0.8.3 | 205 | 3/25/2024 |
0.8.2 | 155 | 3/22/2024 |
0.8.1 | 148 | 3/21/2024 |
0.8.0 | 178 | 3/19/2024 |
0.7.0 | 210 | 2/19/2024 |
0.6.3 | 181 | 1/22/2024 |
0.6.2 | 210 | 12/20/2023 |
0.6.1 | 336 | 10/19/2023 |
0.6.0 | 297 | 2/9/2023 |
0.5.0 | 277 | 1/31/2023 |
0.4.0 | 301 | 1/30/2023 |
0.3.0 | 311 | 1/23/2023 |
0.1.0 | 301 | 11/15/2022 |