Facet.Mapping 1.7.0

dotnet add package Facet.Mapping --version 1.7.0
                    
NuGet\Install-Package Facet.Mapping -Version 1.7.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Facet.Mapping" Version="1.7.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Facet.Mapping" Version="1.7.0" />
                    
Directory.Packages.props
<PackageReference Include="Facet.Mapping" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Facet.Mapping --version 1.7.0
                    
#r "nuget: Facet.Mapping, 1.7.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#addin nuget:?package=Facet.Mapping&version=1.7.0
                    
Install Facet.Mapping as a Cake Addin
#tool nuget:?package=Facet.Mapping&version=1.7.0
                    
Install Facet.Mapping as a Cake Tool

Facet.Mapping

Facet.Mapping enables advanced static mapping logic for the Facet source generator.

This package defines a strongly-typed interface that allows you to plug in custom mapping logic between source and generated Facet types � all at compile time, with zero runtime reflection.


What is this for?

Facet lets you define slim, redacted, or projected versions of classes using just attributes.
With Facet.Mapping, you can go further � and define custom logic like combining properties, renaming, transforming types, or applying conditions.


How it works

  1. Implement the IFacetMapConfiguration<TSource, TTarget> interface.
  2. Define a static Map method.
  3. Point the [Facet(...)] attribute to the config class using Configuration = typeof(...).

Install

dotnet add package Facet.Mapping

## Example

```csharp
public class User
{
    public string FirstName { get; set; }
    public string LastName { get; set; }
}

[Facet(typeof(User), GenerateConstructor = true, Configuration = typeof(UserMapper))]
public partial class UserDto
{
    public string FullName { get; set; }
}
public class UserMapper : IFacetMapConfiguration<User, UserDto>
{
    public static void Map(User source, UserDto target)
    {
        target.FullName = $"{source.FirstName} {source.LastName}";
    }
}

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.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
1.7.0 125 5/6/2025
1.6.0 108 4/27/2025
1.5.0 76 4/26/2025
1.4.0 106 4/25/2025
1.3.0 134 4/24/2025
1.2.0 129 4/24/2025
1.1.1 137 4/23/2025
1.1.0 126 4/23/2025
1.0.0 136 4/23/2025