Skip to main content

IncrementalSourceGenerator.BuilderPattern by Martin Barrett Nielsen

NuGet / site data​

Nuget GitHub last commit GitHub Repo stars

Details​

Info​

info

Name: IncrementalSourceGenerator.BuilderPattern

Incremental source generator that that reduces boilerplate in test object builders by generating the repetitive structure, while enabling developers to focus on the more meaningful, hand-crafted logic via partial classes

Author: Martin Barrett Nielsen

NuGet: https://www.nuget.org/packages/IncrementalSourceGenerator.BuilderPattern/

You can find more details at https://github.com/MartinBarrettNielsen11/Incremental-source-generator-builder-pattern

Source: https://github.com/MartinBarrettNielsen11/Incremental-source-generator-builder-pattern

Author​

note

Martin Barrett Nielsen Alt text

Original Readme​

note

About​

note

Generate builder pattern code for classes with many properties

How to use​

Example (source csproj, source files)​

This is the CSharp Project that references IncrementalSourceGenerator.BuilderPattern

<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0</TargetFramework>
<Nullable>enable</Nullable>
</PropertyGroup>

<PropertyGroup>
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
<CompilerGeneratedFilesOutputPath>$(BaseIntermediateOutputPath)\GX</CompilerGeneratedFilesOutputPath>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="IncrementalSourceGenerator.BuilderPattern" Version="1.0.2" />
</ItemGroup>
</Project>

Generated Files​

Those are taken from $(BaseIntermediateOutputPath)\GX

#nullable enable
#pragma warning disable CA1813, CA1019, IDE0065, IDE0034, IDE0055

using System;

namespace Generator;

[System.CodeDom.Compiler.GeneratedCode("Generator", "v1")]
[AttributeUsage(AttributeTargets.Class)]
public sealed class BuilderAttribute(Type type) : Attribute
{
public Type TargetType \{ get; \} = type;
}

#pragma warning restore CA1813, CA1019, IDE0065, IDE0034, IDE0055

Useful​

Download Example (.NET C#)​

Share IncrementalSourceGenerator.BuilderPattern​

https://ignatandrei.github.io/RSCG_Examples/v2/docs/IncrementalSourceGenerator.BuilderPattern

Category "Builder" has the following generators:​

1 Architect.DomainModeling Nuget GitHub Repo stars 2024-03-02

2 BuilderGenerator Nuget GitHub Repo stars 2023-10-04

3 DimonSmart.BuilderGenerator Nuget GitHub Repo stars 2025-07-03

4 Fluentify Nuget GitHub Repo stars 2024-08-02

5 Hsu.Sg.FluentMember Nuget GitHub Repo stars 2024-11-08

6 IncrementalSourceGenerator.BuilderPattern Nuget GitHub Repo stars 2026-08-23

7 OrderedBuildersGenerator Nuget GitHub Repo stars 2025-12-18

8 ShadowWriterBuilder Nuget GitHub Repo stars 2025-07-24

9 StepwiseBuilderGenerator Nuget GitHub Repo stars 2025-03-23

10 TypedStateBuilder.Generator Nuget GitHub Repo stars 2026-05-16

See category​

Builder