Facet.Extensions 1.8.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Facet.Extensions --version 1.8.0
                    
NuGet\Install-Package Facet.Extensions -Version 1.8.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.Extensions" Version="1.8.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Facet.Extensions" Version="1.8.0" />
                    
Directory.Packages.props
<PackageReference Include="Facet.Extensions" />
                    
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.Extensions --version 1.8.0
                    
#r "nuget: Facet.Extensions, 1.8.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.
#:package Facet.Extensions@1.8.0
                    
#: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=Facet.Extensions&version=1.8.0
                    
Install as a Cake Addin
#tool nuget:?package=Facet.Extensions&version=1.8.0
                    
Install as a Cake Tool

Facet

NuGet Downloads License: MIT

"One part of a subject, situation, object that has many parts."

Facet is a C# source generator that lets you define lightweight projections (DTOs, API models, etc.) directly from your domain models — without writing boilerplate.

It generates partial classes, records, structs, or record structs with constructors, optional LINQ projections, and even supports custom mappings — all at compile time, with zero runtime cost.


What is Facetting?

Facetting is the process of defining focused views of a larger model at compile time.

Instead of manually writing separate DTOs, mappers, and projections, Facet allows you to declare what you want to keep — and generates everything else.

You can think of it like carving out a specific facet of a gem:

  • The part you care about
  • Leaving the rest behind.

Why Facetting?

  • Reduce duplication across DTOs, projections, and ViewModels
  • Maintain strong typing with no runtime cost
  • Stay DRY (Don't Repeat Yourself) without sacrificing performance
  • Works seamlessly with LINQ providers like Entity Framework

Key Features

  • ✅ Generate classes, records, structs, or record structs from existing types
  • ✅ Exclude fields/properties you don't want (create a Facetted view of your model)
  • ✅ Include public fields (optional)
  • ✅ Auto-generate constructors for fast mapping
  • ✅ LINQ projection expressions (Expression<Func<TSource,TTarget>>)
  • ✅ Custom mapping via IFacetMapConfiguration

Documentation

The Facet Ecosystem

Facet is modular and consists of several NuGet packages:

  • Facet: The core source generator. Generates DTOs, projections, and mapping code.
  • Facet.Extensions: Provider-agnostic extension methods for mapping and projecting (works with any LINQ provider, no EF Core dependency).
  • Facet.Extensions.EFCore: Async extension methods for Entity Framework Core (requires EF Core 6+).
  • Facet.Mapping: (Optional) Advanced static mapping configuration support for Facet.

Facet — Define less, project more.

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.  net10.0 was computed.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.0

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Facet.Extensions:

Package Downloads
Facet.Extensions.EFCore

EF Core async extension methods for Facet.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.6.1 22 9/10/2025
2.6.0 50 9/9/2025
2.5.0 228 9/4/2025
2.4.8 163 9/3/2025
2.4.7 204 9/1/2025
2.4.6 128 9/1/2025
2.4.5 189 8/30/2025
2.4.4 318 8/27/2025
2.4.3 181 8/27/2025
2.4.2 177 8/27/2025
2.4.0 205 8/26/2025
2.3.0 1,428 8/20/2025
2.2.0 155 8/20/2025
2.1.0 259 8/18/2025
2.0.1 576 8/5/2025
2.0.0 147 8/4/2025
1.9.3 132 7/4/2025
1.8.0 161 6/4/2025
1.7.0 201 5/6/2025
1.6.0 145 4/27/2025
1.5.0 170 4/27/2025