Facet.Mapping
1.7.0
dotnet add package Facet.Mapping --version 1.7.0
NuGet\Install-Package Facet.Mapping -Version 1.7.0
<PackageReference Include="Facet.Mapping" Version="1.7.0" />
<PackageVersion Include="Facet.Mapping" Version="1.7.0" />
<PackageReference Include="Facet.Mapping" />
paket add Facet.Mapping --version 1.7.0
#r "nuget: Facet.Mapping, 1.7.0"
#addin nuget:?package=Facet.Mapping&version=1.7.0
#tool nuget:?package=Facet.Mapping&version=1.7.0
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
- Implement the
IFacetMapConfiguration<TSource, TTarget>
interface. - Define a static
Map
method. - Point the
[Facet(...)]
attribute to the config class usingConfiguration = 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 | Versions 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. |
-
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.