SourceKit.Generators.Builder 1.2.34

The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org. Prefix Reserved
dotnet add package SourceKit.Generators.Builder --version 1.2.34
NuGet\Install-Package SourceKit.Generators.Builder -Version 1.2.34
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="SourceKit.Generators.Builder" Version="1.2.34" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SourceKit.Generators.Builder --version 1.2.34
#r "nuget: SourceKit.Generators.Builder, 1.2.34"
#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 SourceKit.Generators.Builder as a Cake Addin
#addin nuget:?package=SourceKit.Generators.Builder&version=1.2.34

// Install SourceKit.Generators.Builder as a Cake Tool
#tool nuget:?package=SourceKit.Generators.Builder&version=1.2.34

SourceKit.Generators.Builder

Use [GenerateBuilder] attribute to generate builder.

  • Only record or record struct types are supported
  • Builder is a nested class Builder
  • For collection properties field of type List<> will be generated
  • For collection properties, methods With{PropName} and With{PropName}s will be generated
  • If collection element type is IComparable or IComparable<TSelf> the .Distinct LINQ method would be called on .Build method
  • If collection property is List<> or HashSet<> then it will be converted to this collection respectively, otherwise, ToArray method will be called

You can use SomeType.Build() static method to shorthand create type instance using generated builder

[GenerateBuilder]
public partial record SomeQuery(IReadOnlyCollection<Guid> Ids, int Count = 10);

...

var query = SomeQuery.Build(x => x.WithCount(2).WithId(Guid.NewGuid());

Default values for record properties are supported

Required properties

You can annotate property with [RequiredValue] attribute to force compile time error when it is not initialized withing Build method of model.

[GenerateBuilder]
public partial record SomeQuery(long[] Ids, [RequiredValue] int PageSize);

The following code will produce an error.

var query = SomeQuery.Build(x => x.WithId(1));
There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on SourceKit.Generators.Builder:

Package Downloads
Itmo.Dev.Platform.BackgroundTasks The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org.

Package Description

Itmo.Dev.Platform.MessagePersistence The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org.

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.2.34 115 5/4/2024
1.2.33 66 5/1/2024
1.2.31 92 4/27/2024
1.2.30 131 4/6/2024
1.1.29 124 4/3/2024
1.1.27 93 4/3/2024
1.1.26 109 4/3/2024
1.1.24 1,111 12/19/2023
1.1.23 183 12/6/2023
1.1.22 247 11/22/2023
1.1.21 591 11/11/2023
1.1.20 72 11/11/2023
1.1.19 155 11/11/2023
1.1.18 99 11/11/2023
1.1.16 76 11/11/2023
1.1.15 92 11/11/2023
1.1.14 105 11/11/2023
1.1.13 132 11/11/2023
1.1.11 89 11/11/2023
1.1.10 185 9/16/2023
1.1.4 227 9/10/2023
1.0.4 1,060 6/11/2023
1.0.3 151 6/10/2023
1.0.2 118 6/10/2023
1.0.1 350 5/14/2023
1.0.0 141 5/13/2023

Added default values support