Fennekin23.BuilderGenerator 1.0.0-alpha.0.4

This is a prerelease version of Fennekin23.BuilderGenerator.
This package has a SemVer 2.0.0 package version: 1.0.0-alpha.0.4+21.8898658391.1.
dotnet add package Fennekin23.BuilderGenerator --version 1.0.0-alpha.0.4
NuGet\Install-Package Fennekin23.BuilderGenerator -Version 1.0.0-alpha.0.4
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="Fennekin23.BuilderGenerator" Version="1.0.0-alpha.0.4" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Fennekin23.BuilderGenerator --version 1.0.0-alpha.0.4
#r "nuget: Fennekin23.BuilderGenerator, 1.0.0-alpha.0.4"
#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 Fennekin23.BuilderGenerator as a Cake Addin
#addin nuget:?package=Fennekin23.BuilderGenerator&version=1.0.0-alpha.0.4&prerelease

// Install Fennekin23.BuilderGenerator as a Cake Tool
#tool nuget:?package=Fennekin23.BuilderGenerator&version=1.0.0-alpha.0.4&prerelease

Fennekin23.BuilderGenerator

A Source Generator package that generates builder classes for records, to allow convenient complex object building.

This source generator requires the .NET 7 SDK. You can target earlier frameworks like .NET Core 3.1 etc, but the SDK must be at least 7.0.100

To use the generator, add the [BuilderGenerator] attribute to a record. For example:

[BuilderGenerator]
public record SamplePublicPositionalRecord(string StringProperty, int IntProperty)
{
    public bool BooleanProperty { get; init; }
             
    public long LongProperty { get; set; }
}

This will generate a class called SamplePublicPositionalRecordBuilder (by default), which contains a number of helper methods. For example:

public sealed partial class SamplePublicPositionalRecordBuilder
{
    private String _stringproperty = default!;
    public SamplePublicPositionalRecordBuilder WithStringProperty(String value)
    {
        _stringproperty = value;
        return this;
    }
    private Int32 _intproperty = default!;
    public SamplePublicPositionalRecordBuilder WithIntProperty(Int32 value)
    {
        _intproperty = value;
        return this;
    }
    private Boolean _booleanproperty = default!;
    public SamplePublicPositionalRecordBuilder WithBooleanProperty(Boolean value)
    {
        _booleanproperty = value;
        return this;
    }
    private Int64 _longproperty = default!;
    public SamplePublicPositionalRecordBuilder WithLongProperty(Int64 value)
    {
        _longproperty = value;
        return this;
    }
    public Fennekin23.BuilderGenerator.Sample.SamplePublicPositionalRecord Build()
    {
        return new Fennekin23.BuilderGenerator.Sample.SamplePublicPositionalRecord(StringProperty: _stringproperty, IntProperty: _intproperty)
        {
            BooleanProperty = _booleanproperty,
            LongProperty = _longproperty
        };
    }
}
There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.0-alpha.0.4 0 4/30/2024