SourceKit.Generators.Builder
1.2.50
Prefix Reserved
dotnet add package SourceKit.Generators.Builder --version 1.2.50
NuGet\Install-Package SourceKit.Generators.Builder -Version 1.2.50
<PackageReference Include="SourceKit.Generators.Builder" Version="1.2.50" />
<PackageVersion Include="SourceKit.Generators.Builder" Version="1.2.50" />
<PackageReference Include="SourceKit.Generators.Builder" />
paket add SourceKit.Generators.Builder --version 1.2.50
#r "nuget: SourceKit.Generators.Builder, 1.2.50"
#:package SourceKit.Generators.Builder@1.2.50
#addin nuget:?package=SourceKit.Generators.Builder&version=1.2.50
#tool nuget:?package=SourceKit.Generators.Builder&version=1.2.50
SourceKit.Generators.Builder
Use [GenerateBuilder] attribute to generate builder.
- Only
recordorrecord structtypes are supported - Builder is a nested class
Builder - For collection properties field of type
List<>will be generated - For collection properties, methods
With{PropName}andWith{PropName}swill be generated - If collection element type is
IComparableorIComparable<TSelf>the.DistinctLINQ method would be called on.Buildmethod - If collection property is
List<>orHashSet<>then it will be converted to this collection respectively, otherwise,ToArraymethod 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));
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
- FluentChaining (>= 1.0.4)
- Humanizer.Core (>= 2.14.1)
- Humanizer.Core.uk (>= 2.14.1)
- Microsoft.CodeAnalysis.Common (>= 4.9.2)
- Microsoft.CodeAnalysis.CSharp (>= 4.9.2)
- Microsoft.CodeAnalysis.Workspaces.Common (>= 4.9.2)
- Microsoft.Extensions.DependencyInjection (>= 3.0.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 3.0.0)
- SourceKit (>= 1.1.50)
- SourceKit.Generators.Builder.Annotations (>= 1.1.50)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on SourceKit.Generators.Builder:
| Package | Downloads |
|---|---|
|
Itmo.Dev.Platform.BackgroundTasks
Package Description |
|
|
Itmo.Dev.Platform.MessagePersistence
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.2.50 | 1,201 | 5/16/2025 |
| 1.2.49 | 493 | 1/13/2025 |
| 1.2.48 | 160 | 1/13/2025 |
| 1.2.47 | 167 | 1/12/2025 |
| 1.2.46 | 183 | 1/12/2025 |
| 1.2.45 | 621 | 12/15/2024 |
| 1.2.44 | 375 | 12/15/2024 |
| 1.2.43 | 175 | 12/15/2024 |
| 1.2.42 | 168 | 12/15/2024 |
| 1.2.41 | 199 | 12/15/2024 |
| 1.2.40 | 186 | 12/15/2024 |
| 1.2.37 | 197 | 12/14/2024 |
| 1.2.36 | 670 | 11/18/2024 |
| 1.2.35 | 264 | 10/11/2024 |
| 1.2.34 | 318 | 5/4/2024 |
| 1.2.33 | 194 | 5/1/2024 |
| 1.2.31 | 235 | 4/27/2024 |
| 1.2.30 | 274 | 4/6/2024 |
| 1.1.29 | 241 | 4/3/2024 |
| 1.1.27 | 233 | 4/3/2024 |
| 1.1.26 | 224 | 4/3/2024 |
| 1.1.24 | 7,211 | 12/19/2023 |
| 1.1.23 | 292 | 12/6/2023 |
| 1.1.22 | 438 | 11/22/2023 |
| 1.1.21 | 694 | 11/11/2023 |
| 1.1.20 | 156 | 11/11/2023 |
| 1.1.19 | 234 | 11/11/2023 |
| 1.1.18 | 183 | 11/11/2023 |
| 1.1.16 | 164 | 11/11/2023 |
| 1.1.15 | 202 | 11/11/2023 |
| 1.1.14 | 206 | 11/11/2023 |
| 1.1.13 | 221 | 11/11/2023 |
| 1.1.11 | 174 | 11/11/2023 |
| 1.1.10 | 273 | 9/16/2023 |
| 1.1.4 | 343 | 9/10/2023 |
| 1.0.4 | 1,715 | 6/11/2023 |
| 1.0.3 | 271 | 6/10/2023 |
| 1.0.2 | 245 | 6/10/2023 |
| 1.0.1 | 483 | 5/14/2023 |
| 1.0.0 | 341 | 5/13/2023 |
Added default values support