FluentBuilder 0.9.2

Usage

:one: 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; }
}

:two: 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.

Showing the top 20 packages that depend on FluentBuilder.

Packages Downloads
WireMock.Net.Abstractions
Commonly used interfaces, models, enumerations and types.
11

0.9.2 (30 August 2024)

  • #64 Support "internal" for class and custom builder [enhancement]

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

.NET Standard 2.0

  • No dependencies.

Version Downloads Last updated
0.16.0 1 11/13/2026
0.15.0 10 06/24/2026
0.14.0 11 06/24/2026
0.13.0 10 06/24/2026
0.12.0 8 06/24/2026
0.11.0 12 06/20/2026
0.11.0-preview-02 9 06/29/2026
0.11.0-preview-01 8 06/20/2026
0.10.0.4-preview-01 10 06/20/2026
0.10.0.3-preview-01 9 06/29/2026
0.10.0.2 11 06/26/2026
0.10.0.1 10 06/24/2026
0.10.0 12 06/20/2026
0.9.2 11 06/20/2026
0.9.1 8 06/25/2026
0.9.0 16 12/17/2023
0.9.0-preview-01 12 12/25/2023
0.8.0 14 01/07/2024
0.7.1 11 01/04/2024
0.7.1-preview-02 11 01/08/2024
0.7.1-preview-01 10 01/08/2024
0.7.0 14 01/05/2024
0.7.0-preview-01 13 01/08/2024
0.6.0 17 12/29/2023
0.5.1 15 12/14/2023
0.5.0 15 12/17/2023
0.4.9 10 01/07/2024
0.4.8 12 12/25/2023
0.4.7 12 01/07/2024
0.4.6 12 01/06/2024
0.4.5 12 01/06/2024
0.4.4 14 01/01/2024
0.4.2 12 01/06/2024
0.4.1 11 01/05/2024
0.4.0 12 01/07/2024
0.3.3 13 01/06/2024
0.3.2 14 01/05/2024
0.3.1 13 01/05/2024
0.3.0 16 01/05/2024
0.2.5 11 01/07/2024
0.2.4 12 01/02/2024
0.2.3 11 01/07/2024
0.2.2 12 01/05/2024
0.2.1 12 01/05/2024
0.2.0 11 01/07/2024
0.1.2 13 01/04/2024
0.1.1 12 01/05/2024
0.1.0 15 12/29/2023
0.0.11 11 01/07/2024
0.0.11-preview-01 11 12/26/2023
0.0.10 12 01/07/2024
0.0.10-preview-03 15 01/08/2024
0.0.10-preview-02 10 01/08/2024
0.0.10-preview-01 11 01/08/2024
0.0.9 13 12/24/2023
0.0.8 17 01/06/2024
0.0.7 11 01/07/2024
0.0.6 14 01/05/2024
0.0.5 15 01/05/2024
0.0.4 14 01/06/2024
0.0.3 13 01/05/2024
0.0.2 14 01/06/2024
0.0.1 12 01/07/2024