FluentBuilder 0.3.2

There is a newer version of this package available.
See the version list below for details.
dotnet add package FluentBuilder --version 0.3.2
NuGet\Install-Package FluentBuilder -Version 0.3.2
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.3.2">
  <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.
paket add FluentBuilder --version 0.3.2
#r "nuget: FluentBuilder, 0.3.2"
#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.
// Install FluentBuilder as a Cake Addin
#addin nuget:?package=FluentBuilder&version=0.3.2

// Install FluentBuilder as a Cake Tool
#tool nuget:?package=FluentBuilder&version=0.3.2

Usage

1️⃣ 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; }
}

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 [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}");
        }
    }
}
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 (2)

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

Repository Stars
WireMock-Net/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.
StefH/FluentBuilder
A project which uses Source Generation to create a FluentBuilder for a specified model or DTO
Version Downloads Last updated
0.9.0 20,827 4/8/2023
0.9.0-preview-01 103 4/6/2023
0.8.0 403 4/3/2023
0.7.1 374 3/14/2023
0.7.1-preview-02 164 3/2/2023
0.7.1-preview-01 149 2/25/2023
0.7.0 7,667 9/20/2022
0.7.0-preview-01 131 9/16/2022
0.6.0 445 8/20/2022
0.5.1 1,843 7/28/2022
0.5.0 459 7/13/2022
0.4.9 4,635 6/25/2022
0.4.8 412 6/21/2022
0.4.7 401 6/4/2022
0.4.6 480 5/20/2022
0.4.5 410 5/16/2022
0.4.4 1,023 4/27/2022
0.4.2 448 4/3/2022
0.4.1 925 2/18/2022
0.4.0 397 2/18/2022
0.3.3 402 2/16/2022
0.3.2 411 2/16/2022
0.3.1 405 2/14/2022
0.3.0 402 2/12/2022
0.2.5 410 2/8/2022
0.2.4 452 2/6/2022
0.2.3 413 2/1/2022
0.2.2 415 1/31/2022
0.2.1 428 1/30/2022
0.2.0 462 1/30/2022
0.1.2 413 1/20/2022
0.1.1 406 1/15/2022
0.1.0 413 1/13/2022
0.0.11 1,392 8/10/2021
0.0.11-preview-01 206 8/10/2021
0.0.10 285 8/8/2021
0.0.10-preview-03 179 8/8/2021
0.0.10-preview-02 208 8/7/2021
0.0.10-preview-01 208 8/7/2021
0.0.9 390 8/7/2021
0.0.8 297 8/6/2021
0.0.7 429 8/5/2021
0.0.6 295 8/5/2021
0.0.5 348 8/5/2021
0.0.4 12,131 7/21/2021
0.0.3 307 7/19/2021
0.0.2 298 7/19/2021
0.0.1 337 7/18/2021

# 0.3.2 (16 February 2022)
- #20 Do not inherit IEnumerableBuilder anymore [enhancement]

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