Facet 1.0.1
See the version list below for details.
dotnet add package Facet --version 1.0.1
NuGet\Install-Package Facet -Version 1.0.1
<PackageReference Include="Facet" Version="1.0.1" />
<PackageVersion Include="Facet" Version="1.0.1" />
<PackageReference Include="Facet" />
paket add Facet --version 1.0.1
#r "nuget: Facet, 1.0.1"
#:package Facet@1.0.1
#addin nuget:?package=Facet&version=1.0.1
#tool nuget:?package=Facet&version=1.0.1
Facet
Facet is a compile-time source generator that creates partial classes from existing types — by copying only the members you want.
Exclude properties, include public fields, add your own members, or generate a constructor — all with a single [Facet]
attribute.
Use Facet to build lightweight DTOs, API shapes, or UI-bound view models without writing boilerplate or mapping code.
No base classes. No reflection. No runtime cost.
Features
- ✅ Exclude properties and fields with
nameof(...)
- ✅ Include public fields (optional)
- ✅ Generate constructors that copy from the source type
- ✅ Add your own extra properties in the generated type
- ✅ No base class or interface required
- ✅ No runtime reflection — compile-time only
- ✅ Works with or without namespaces
Quick Start
1. Install
dotnet add package Facet
2. Use
using Facet;
public class Person
{
public string Name { get; set; }
public string Email { get; set; }
public int Age { get; set; }
}
[Facet(typeof(Person), nameof(Person.Email))]
public partial class PersonWithoutEmail
{
}
3. What gets generated
public partial class PersonWithoutEmail
{
public string Name { get; set; }
public int Age { get; set; }
}
4 Extending
[Facet(typeof(Person),
excludes: new [] { nameof(Person.Email), nameof(Person.Age) } )]
public partial class PersonNameWithNote
{
public string Note { get; set; }
}
Becomes:
public partial class PersonNameWithNote
{
public string Name { get; set; }
public string Note { get; set; }
}
5 Constructors
[Facet(typeof(Person), nameof(Person.Email), GenerateConstructor = true)]
public partial class PersonDto { }
Now you can do:
var person = new Person();
var dto = new PersonDto(person);
Which results in:
public partial class PersonDto
{
public string Name { get; set; }
public int Age { get; set; }
public Guid RawId;
public PersonDto(Person source)
{
this.Name = source.Name;
this.Age = source.Age;
this.RawId = source.RawId;
}
}
Why Facet?
Why Facet? No mappings. No reflection. No bloated libraries.
Just clean, compile-time class shaping — with minimal syntax and full control.
Package Info
- Target frameworks: netstandard2.0
- Supports: .NET Core 3.1+, .NET 5+, .NET 6+, .NET 7, .NET 8
- Analyzer delivery: Source generator is embedded in the NuGet package
Product | Versions 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 was computed. 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. |
.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. |
-
.NETStandard 2.0
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Facet:
Package | Downloads |
---|---|
Facet.Extensions
Provider-agnostic extension methods for Facet. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last Updated |
---|---|---|
2.6.0 | 7 | 9/9/2025 |
2.5.0 | 239 | 9/4/2025 |
2.4.8 | 187 | 9/3/2025 |
2.4.7 | 236 | 9/1/2025 |
2.4.6 | 131 | 9/1/2025 |
2.4.5 | 197 | 8/30/2025 |
2.4.4 | 411 | 8/27/2025 |
2.4.3 | 187 | 8/27/2025 |
2.4.2 | 179 | 8/27/2025 |
2.4.1 | 213 | 8/26/2025 |
2.4.0 | 202 | 8/26/2025 |
2.3.0 | 1,542 | 8/20/2025 |
2.2.0 | 158 | 8/20/2025 |
2.1.0 | 266 | 8/18/2025 |
2.0.1 | 751 | 8/5/2025 |
2.0.0 | 154 | 8/4/2025 |
1.9.3 | 194 | 7/4/2025 |
1.9.1 | 155 | 7/3/2025 |
1.9.0 | 153 | 7/3/2025 |
1.8.0 | 251 | 6/4/2025 |
1.7.0 | 210 | 5/6/2025 |
1.6.0 | 179 | 4/27/2025 |
1.5.0 | 211 | 4/26/2025 |
1.4.0 | 142 | 4/25/2025 |
1.3.0 | 170 | 4/24/2025 |
1.2.0 | 175 | 4/24/2025 |
1.1.1 | 175 | 4/23/2025 |
1.1.0 | 180 | 4/23/2025 |
1.0.2 | 369 | 4/23/2025 |
1.0.1 | 190 | 4/23/2025 |
1.0.0 | 189 | 4/23/2025 |
0.1.0 | 182 | 4/22/2025 |