Baumeister.Abstractions
0.0.1-Alpha.115
dotnet add package Baumeister.Abstractions --version 0.0.1-Alpha.115
NuGet\Install-Package Baumeister.Abstractions -Version 0.0.1-Alpha.115
<PackageReference Include="Baumeister.Abstractions" Version="0.0.1-Alpha.115" />
<PackageVersion Include="Baumeister.Abstractions" Version="0.0.1-Alpha.115" />
<PackageReference Include="Baumeister.Abstractions" />
paket add Baumeister.Abstractions --version 0.0.1-Alpha.115
#r "nuget: Baumeister.Abstractions, 0.0.1-Alpha.115"
#:package Baumeister.Abstractions@0.0.1-Alpha.115
#addin nuget:?package=Baumeister.Abstractions&version=0.0.1-Alpha.115&prerelease
#tool nuget:?package=Baumeister.Abstractions&version=0.0.1-Alpha.115&prerelease
Baumeister
Baumeister (german for "master builder") is a simple tool that helps by generating builder-pattern classes for your objects.
Installation
For easy installation just use the dotnet cli
dotnet add package Baumeister.Generators
Usage
To generate a builder class for a class House you first have to add a partial class HouseBuilder.
In order to make it findable for Baumeister, you have to make it a generic specialization of BuilderBase<T>.
public partial class HouseBuilder : BuilderBase<House>
{
}
After compilation you are ready to use the newly generated builder.
Examples
Simple Example
public class House
{
public int Floors { get; }
public int Rooms { get; }
public bool HasGarden { get; }
public House(string name, int floors, int rooms, bool hasGarden)
{
Name = name;
Floors = floors;
Rooms = rooms;
HasGarden = hasGarden;
}
}
public partial class HouseBuilder : BuilderBase<House>
{
}
class Program
{
static void Main(string[] args)
{
var house = new HouseBuilder()
.WithFloors(2)
.WithRooms(5)
.WithHasGarden(true)
.Build();
}
}
Setting Default Values in Builders
You can set type-safe default values for your generated builders without modifying your target classes.
Simply implement the partial method OnInitializeDefaults in your partial builder:
public partial class HouseBuilder : BuilderBase<House>
{
partial void OnInitializeDefaults()
{
WithFloors(1);
WithHasGarden(false);
}
}
These defaults are used unless you override them with a WithXyz call before calling Build().
How it works
Baumeister uses the Roslyn compiler to analyze the source code of the project.
It searches for classes that are specializations of BuilderBase and generates a partial class with methods that enables the builder pattern.
The Build() method instantiates the object with the specified properties and returns it. For the instantiation, the builder uses the constructor with the most matching parameters.
It matches the given parameters with the constructor parameters and tries to find the best match. In order to do that it uses the type and names of the properties.
In case not all properties that are set are used by the constructor, the builder will use public properties to set the values.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Microsoft.CodeAnalysis.CSharp (>= 4.11.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Baumeister.Abstractions:
| Package | Downloads |
|---|---|
|
Baumeister.Generators
Baumeister (german for "master builder") is a simple tool that helps by generating builder-pattern classes for your objects. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.0.1-Alpha.115 | 75 | 1/8/2026 |
| 0.0.1-Alpha.112 | 67 | 1/8/2026 |
| 0.0.1-Alpha.110 | 66 | 1/8/2026 |
| 0.0.1-Alpha.106 | 74 | 1/5/2026 |
| 0.0.1-Alpha.102 | 72 | 6/7/2025 |
| 0.0.1-Alpha.101 | 70 | 6/7/2025 |
| 0.0.1-Alpha.97 | 74 | 6/7/2025 |
| 0.0.1-Alpha.91 | 136 | 6/6/2025 |
| 0.0.1-Alpha.89 | 134 | 6/6/2025 |
| 0.0.1-Alpha.85 | 144 | 6/2/2025 |
| 0.0.1-Alpha.84 | 148 | 6/1/2025 |
| 0.0.1-Alpha.83 | 141 | 6/1/2025 |
| 0.0.1-Alpha.78 | 146 | 6/1/2025 |
| 0.0.1-Alpha.77 | 145 | 6/1/2025 |