FluentBuilder 0.9.0

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

Usage

1️⃣ Annotate a class

Annotate a class with [AutoGenerateBuilder] to indicate that a FluentBuilder should be generated for this class:

[AutoGenerateBuilder]
public class User
{
    public string FirstName { get; set; }

    public string LastName { get; set; }

    public DateTime? Date { get; set; }
}

2️⃣ Define a class which needs to act as a builder

This scenario is very usefull when you cannot modify the class to annotate it.

Create a public and partial builder class

And annotate this class with [AutoGenerateBuilder(typeof(XXX))] where XXX is the type for which you want to generate a FluentBuilder.

[AutoGenerateBuilder(typeof(UserDto))]
public partial class MyUserDtoBuilder
{
}

Use FluentBuilder

using System;

namespace Test;

class Program
{
    static void Main(string[] args)
    {
        var user = new UserBuilder()
            .WithFirstName("Test")
            .WithLastName("User")
            .Build();

        Console.WriteLine($"{user.FirstName} {user.LastName}");
    }
}

For more information, see the StefH/FluentBuilder.

There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

  • .NETStandard 2.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on FluentBuilder:

Repository Stars
wiremock/WireMock.Net
WireMock.Net is a flexible product for stubbing and mocking web HTTP responses using advanced request matching and response templating. Based on the functionality from http://WireMock.org, but extended with more functionality.
Version Downloads Last Updated
0.11.0-preview-02 146 6/24/2025
0.11.0-preview-01 136 6/23/2025
0.10.0.3-preview-01 128 7/15/2025
0.10.0.2 660 6/26/2025
0.10.0.1 1,595 6/13/2025
0.10.0 15,299 10/19/2024
0.9.2 6,445 8/30/2024
0.9.1 439 8/24/2024
0.9.0 36,144 4/8/2023
0.9.0-preview-01 185 4/6/2023
0.8.0 483 4/3/2023
0.7.1 473 3/14/2023
0.7.1-preview-02 247 3/2/2023
0.7.1-preview-01 234 2/25/2023
0.7.0 9,937 9/20/2022
0.7.0-preview-01 210 9/16/2022
0.6.0 526 8/20/2022
0.5.1 1,955 7/28/2022
0.5.0 545 7/13/2022
0.4.9 4,727 6/25/2022
0.4.8 494 6/21/2022
0.4.7 489 6/4/2022
0.4.6 576 5/20/2022
0.4.5 504 5/16/2022
0.4.4 1,123 4/27/2022
0.4.2 548 4/3/2022
0.4.1 1,023 2/18/2022
0.4.0 499 2/18/2022
0.3.3 509 2/16/2022
0.3.2 515 2/16/2022
0.3.1 512 2/14/2022
0.3.0 497 2/12/2022
0.2.5 511 2/8/2022
0.2.4 563 2/6/2022
0.2.3 514 2/1/2022
0.2.2 537 1/31/2022
0.2.1 530 1/30/2022
0.2.0 602 1/30/2022 0.2.0 is deprecated because it has critical bugs.
0.1.2 512 1/20/2022
0.1.1 495 1/15/2022
0.1.0 509 1/13/2022
0.0.11 1,500 8/10/2021
0.0.11-preview-01 283 8/10/2021
0.0.10 383 8/8/2021
0.0.10-preview-03 264 8/8/2021
0.0.10-preview-02 296 8/7/2021
0.0.10-preview-01 292 8/7/2021
0.0.9 490 8/7/2021
0.0.8 402 8/6/2021
0.0.7 532 8/5/2021
0.0.6 392 8/5/2021
0.0.5 445 8/5/2021
0.0.4 13,489 7/21/2021
0.0.3 407 7/19/2021
0.0.2 397 7/19/2021
0.0.1 443 7/18/2021

# 0.9.0 (08 April 2023)
- #55 UsingInstance returns correct generated builder [enhancement]
- #56 Add AsBuilder extension method [enhancement]
- #54 Automatic extension method generation for easy updating of existing class instances [enhancement]

The full release notes can be found here: https://github.com/StefH/FluentBuilder/blob/main/ReleaseNotes.md