FluentBuilder 0.6.0
See the version list below for details.
dotnet add package FluentBuilder --version 0.6.0
NuGet\Install-Package FluentBuilder -Version 0.6.0
<PackageReference Include="FluentBuilder" Version="0.6.0"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
<PackageVersion Include="FluentBuilder" Version="0.6.0" />
<PackageReference Include="FluentBuilder"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
paket add FluentBuilder --version 0.6.0
#r "nuget: FluentBuilder, 0.6.0"
#addin nuget:?package=FluentBuilder&version=0.6.0
#tool nuget:?package=FluentBuilder&version=0.6.0
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}");
}
}
}
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.10.0 | 10,789 | 10/19/2024 | |
0.10.0-preview-01 | 62 | 10/7/2024 | |
0.9.2 | 4,597 | 8/30/2024 | |
0.9.1 | 369 | 8/24/2024 | |
0.9.0 | 34,920 | 4/8/2023 | |
0.9.0-preview-01 | 142 | 4/6/2023 | |
0.8.0 | 451 | 4/3/2023 | |
0.7.1 | 437 | 3/14/2023 | |
0.7.1-preview-02 | 202 | 3/2/2023 | |
0.7.1-preview-01 | 193 | 2/25/2023 | |
0.7.0 | 9,734 | 9/20/2022 | |
0.7.0-preview-01 | 172 | 9/16/2022 | |
0.6.0 | 491 | 8/20/2022 | |
0.5.1 | 1,916 | 7/28/2022 | |
0.5.0 | 510 | 7/13/2022 | |
0.4.9 | 4,686 | 6/25/2022 | |
0.4.8 | 457 | 6/21/2022 | |
0.4.7 | 447 | 6/4/2022 | |
0.4.6 | 534 | 5/20/2022 | |
0.4.5 | 458 | 5/16/2022 | |
0.4.4 | 1,083 | 4/27/2022 | |
0.4.2 | 505 | 4/3/2022 | |
0.4.1 | 985 | 2/18/2022 | |
0.4.0 | 453 | 2/18/2022 | |
0.3.3 | 465 | 2/16/2022 | |
0.3.2 | 473 | 2/16/2022 | |
0.3.1 | 460 | 2/14/2022 | |
0.3.0 | 457 | 2/12/2022 | |
0.2.5 | 469 | 2/8/2022 | |
0.2.4 | 522 | 2/6/2022 | |
0.2.3 | 476 | 2/1/2022 | |
0.2.2 | 477 | 1/31/2022 | |
0.2.1 | 489 | 1/30/2022 | |
0.2.0 | 544 | 1/30/2022 | |
0.1.2 | 469 | 1/20/2022 | |
0.1.1 | 459 | 1/15/2022 | |
0.1.0 | 467 | 1/13/2022 | |
0.0.11 | 1,457 | 8/10/2021 | |
0.0.11-preview-01 | 247 | 8/10/2021 | |
0.0.10 | 346 | 8/8/2021 | |
0.0.10-preview-03 | 224 | 8/8/2021 | |
0.0.10-preview-02 | 257 | 8/7/2021 | |
0.0.10-preview-01 | 256 | 8/7/2021 | |
0.0.9 | 455 | 8/7/2021 | |
0.0.8 | 353 | 8/6/2021 | |
0.0.7 | 490 | 8/5/2021 | |
0.0.6 | 349 | 8/5/2021 | |
0.0.5 | 402 | 8/5/2021 | |
0.0.4 | 13,119 | 7/21/2021 | |
0.0.3 | 362 | 7/19/2021 | |
0.0.2 | 354 | 7/19/2021 | |
0.0.1 | 404 | 7/18/2021 |
# 0.6.0 (20 August 2022)
- #46 Add support to exclude properties from base-classes + fixed default value if SuppressNullableWarningExpression
- #47 Support Properties which have 'private set' [enhancement]
- #40 Builder code should handle private setters
The full release notes can be found here: https://github.com/StefH/FluentBuilder/blob/main/ReleaseNotes.md