FluentBuilder 0.9.0-preview-01
See the version list below for details.
dotnet add package FluentBuilder --version 0.9.0-preview-01
NuGet\Install-Package FluentBuilder -Version 0.9.0-preview-01
<PackageReference Include="FluentBuilder" Version="0.9.0-preview-01"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
paket add FluentBuilder --version 0.9.0-preview-01
#r "nuget: FluentBuilder, 0.9.0-preview-01"
// Install FluentBuilder as a Cake Addin #addin nuget:?package=FluentBuilder&version=0.9.0-preview-01&prerelease // Install FluentBuilder as a Cake Tool #tool nuget:?package=FluentBuilder&version=0.9.0-preview-01&prerelease
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.
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.10.0 | 2,359 | 10/19/2024 | |
0.10.0-preview-01 | 50 | 10/7/2024 | |
0.9.2 | 2,076 | 8/30/2024 | |
0.9.1 | 329 | 8/24/2024 | |
0.9.0 | 31,649 | 4/8/2023 | |
0.9.0-preview-01 | 119 | 4/6/2023 | |
0.8.0 | 427 | 4/3/2023 | |
0.7.1 | 406 | 3/14/2023 | |
0.7.1-preview-02 | 178 | 3/2/2023 | |
0.7.1-preview-01 | 168 | 2/25/2023 | |
0.7.0 | 9,363 | 9/20/2022 | |
0.7.0-preview-01 | 148 | 9/16/2022 | |
0.6.0 | 462 | 8/20/2022 | |
0.5.1 | 1,876 | 7/28/2022 | |
0.5.0 | 480 | 7/13/2022 | |
0.4.9 | 4,658 | 6/25/2022 | |
0.4.8 | 430 | 6/21/2022 | |
0.4.7 | 420 | 6/4/2022 | |
0.4.6 | 498 | 5/20/2022 | |
0.4.5 | 428 | 5/16/2022 | |
0.4.4 | 1,049 | 4/27/2022 | |
0.4.2 | 474 | 4/3/2022 | |
0.4.1 | 946 | 2/18/2022 | |
0.4.0 | 419 | 2/18/2022 | |
0.3.3 | 428 | 2/16/2022 | |
0.3.2 | 437 | 2/16/2022 | |
0.3.1 | 426 | 2/14/2022 | |
0.3.0 | 421 | 2/12/2022 | |
0.2.5 | 431 | 2/8/2022 | |
0.2.4 | 485 | 2/6/2022 | |
0.2.3 | 443 | 2/1/2022 | |
0.2.2 | 444 | 1/31/2022 | |
0.2.1 | 456 | 1/30/2022 | |
0.2.0 | 485 | 1/30/2022 | |
0.1.2 | 433 | 1/20/2022 | |
0.1.1 | 426 | 1/15/2022 | |
0.1.0 | 433 | 1/13/2022 | |
0.0.11 | 1,422 | 8/10/2021 | |
0.0.11-preview-01 | 219 | 8/10/2021 | |
0.0.10 | 312 | 8/8/2021 | |
0.0.10-preview-03 | 195 | 8/8/2021 | |
0.0.10-preview-02 | 228 | 8/7/2021 | |
0.0.10-preview-01 | 227 | 8/7/2021 | |
0.0.9 | 421 | 8/7/2021 | |
0.0.8 | 318 | 8/6/2021 | |
0.0.7 | 455 | 8/5/2021 | |
0.0.6 | 316 | 8/5/2021 | |
0.0.5 | 369 | 8/5/2021 | |
0.0.4 | 12,697 | 7/21/2021 | |
0.0.3 | 329 | 7/19/2021 | |
0.0.2 | 320 | 7/19/2021 | |
0.0.1 | 369 | 7/18/2021 |
# 0.8.0 (03 April 2023)
- #52 AttributeArgumentListParser : Update TryParseAsEnum [enhancement]
- #53 By default : generate only the With*** builder methods [enhancement]
The full release notes can be found here: https://github.com/StefH/FluentBuilder/blob/main/ReleaseNotes.md