FluentBuilder 0.4.0

Usage

:one: Annotate a class

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

[FluentBuilder.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 [FluentBuilder.AutoGenerateBuilder(typeof(XXX))] where XXX is the type for which you want to generate a FluentBuilder.

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

Use FluentBuilder

using System;

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

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

Showing the top 20 packages that depend on FluentBuilder.

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

0.4.0 (18 February 2022)

  • #21 Use full type name + change namespace from builders [bug]

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.15.0 13 10/01/2026
0.14.0 8 10/01/2026
0.13.0 8 10/01/2026
0.12.0 8 10/01/2026
0.11.0 9 10/01/2026
0.11.0-preview-02 10 10/01/2026
0.11.0-preview-01 10 10/01/2026
0.10.0.4-preview-01 8 10/01/2026
0.10.0.3-preview-01 7 10/01/2026
0.10.0.2 9 10/01/2026
0.10.0.1 9 10/01/2026
0.10.0 12 10/01/2026
0.9.2 10 10/01/2026
0.9.1 9 10/01/2026
0.9.0 9 10/01/2026
0.9.0-preview-01 7 10/01/2026
0.8.0 10 10/01/2026
0.7.1 11 10/01/2026
0.7.1-preview-02 8 10/01/2026
0.7.1-preview-01 11 10/01/2026
0.7.0 10 10/01/2026
0.7.0-preview-01 10 10/01/2026
0.6.0 6 10/01/2026
0.5.1 10 10/01/2026
0.5.0 7 10/01/2026
0.4.9 8 10/01/2026
0.4.8 11 10/01/2026
0.4.7 11 10/01/2026
0.4.6 9 10/01/2026
0.4.5 7 10/01/2026
0.4.4 11 10/01/2026
0.4.2 9 10/01/2026
0.4.1 9 10/01/2026
0.4.0 10 10/01/2026
0.3.3 9 10/01/2026
0.3.2 10 10/01/2026
0.3.1 8 10/01/2026
0.3.0 10 10/01/2026
0.2.5 7 10/01/2026
0.2.4 11 10/01/2026
0.2.3 10 10/01/2026
0.2.2 8 10/01/2026
0.2.1 11 10/01/2026
0.2.0 8 10/01/2026
0.1.2 10 10/01/2026
0.1.1 8 10/01/2026
0.1.0 11 10/01/2026
0.0.11 9 10/01/2026
0.0.11-preview-01 10 10/01/2026
0.0.10 14 10/01/2026
0.0.10-preview-03 11 10/01/2026
0.0.10-preview-02 10 10/01/2026
0.0.10-preview-01 11 10/01/2026
0.0.9 8 10/01/2026
0.0.8 9 10/01/2026
0.0.7 8 10/01/2026
0.0.6 8 10/01/2026
0.0.5 8 10/01/2026
0.0.4 10 10/01/2026
0.0.3 9 10/01/2026
0.0.2 8 10/01/2026
0.0.1 8 10/01/2026