Facette.Abstractions 1.0.2

dotnet add package Facette.Abstractions --version 1.0.2
                    
NuGet\Install-Package Facette.Abstractions -Version 1.0.2
                    
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="Facette.Abstractions" Version="1.0.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Facette.Abstractions" Version="1.0.2" />
                    
Directory.Packages.props
<PackageReference Include="Facette.Abstractions" />
                    
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 Facette.Abstractions --version 1.0.2
                    
#r "nuget: Facette.Abstractions, 1.0.2"
                    
#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.
#:package Facette.Abstractions@1.0.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Facette.Abstractions&version=1.0.2
                    
Install as a Cake Addin
#tool nuget:?package=Facette.Abstractions&version=1.0.2
                    
Install as a Cake Tool

<p align="center"> <img src="docs/facette.png" alt="Facette logo" width="200" /> </p>

You're probably searching for Facet.

A C# source generator that auto-generates DTO mapping code from [Facette]-annotated partial records — zero reflection, zero runtime dependencies.

This project is entirely vibe coded with Claude Code.

NuGet NuGet Downloads License Build

Features

  • Compile-time mappingFromSource(), ToSource(), and LINQ Projection generated via Roslyn
  • Property control — Include/Exclude lists, [MapFrom] renaming, [FacetteIgnore]
  • Nested objects & collections — auto-detected nested DTOs with List<T>, arrays, HashSet<T>, ImmutableArray<T>
  • Flattening — convention-based (HomeAddressCity) and explicit dot-notation ([MapFrom("HomeAddress.City")])
  • Value conversions — custom Convert/ConvertBack methods on [MapFrom]
  • Enum conversion — auto-detect enum↔string/int mismatches
  • Nullable modeAllNullable for PATCH DTOs, AllRequired for strict contracts
  • Copy attributes — forward data annotations from source to DTO
  • CRUD presetsFacettePreset.Create (no Id, no projection) and FacettePreset.Read (no ToSource)
  • Conditional mapping[MapWhen] for runtime-toggled property inclusion
  • HooksOnAfterFromSource, OnBeforeToSource, OnAfterToSource partial methods
  • Inheritance — base/derived DTO hierarchies
  • Multi-source mapping[AdditionalSource] to combine multiple source types
  • Expression mappingMapExpression<TResult>() rewrites DTO predicates to source expressions
  • EF Core integrationProjectToFacette() and WhereFacette() extensions (no reflection)
  • 13 compile-time diagnostics — FCT001–FCT013 catch configuration errors early

Quick start

dotnet add package Facette.Abstractions
dotnet add package Facette

Define your model and DTO:

public class Employee
{
    public int Id { get; set; }
    public string FirstName { get; set; } = "";
    public string LastName { get; set; } = "";
    public string Email { get; set; } = "";
    public decimal Salary { get; set; }
    public string SocialSecurityNumber { get; set; } = "";
}

[Facette(typeof(Employee), "SocialSecurityNumber")]
public partial record EmployeeDto;

Use the generated code:

// Source → DTO
var dto = EmployeeDto.FromSource(employee);

// DTO → Source
var entity = dto.ToSource();

// LINQ projection (translates to SQL with EF Core)
var dtos = dbContext.Employees
    .Select(EmployeeDto.Projection)
    .ToListAsync();

Packages

Package Description
Facette.Abstractions Attributes ([Facette], [MapFrom], [MapWhen], etc.)
Facette Source generator (compile-time only)
Facette.EntityFrameworkCore EF Core extensions (ProjectToFacette, WhereFacette)

Documentation

Full documentation is available in the mdbook — run mdbook serve docs/ to browse locally.

Credits

Facette was heavily inspired by Facet and Mapperly.

License

See LICENSE for details.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  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 is compatible.  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.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.0

    • No dependencies.
  • net10.0

    • No dependencies.
  • net8.0

    • No dependencies.
  • net9.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Facette.Abstractions:

Package Downloads
Facette.EntityFrameworkCore

EF Core integration for Facette with ProjectToFacette and WhereFacette query extensions.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.2 114 3/18/2026
1.0.1 113 3/2/2026