Typely.Generators
1.8.0
dotnet add package Typely.Generators --version 1.8.0
NuGet\Install-Package Typely.Generators -Version 1.8.0
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="Typely.Generators" Version="1.8.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Typely.Generators --version 1.8.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Typely.Generators, 1.8.0"
#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 Typely.Generators as a Cake Addin #addin nuget:?package=Typely.Generators&version=1.8.0 // Install Typely.Generators as a Cake Tool #tool nuget:?package=Typely.Generators&version=1.8.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Typely: Unleashing the power of value object creation with a fluent Api.
Example
public class TypesSpecification : ITypelySpecification
{
public void Create(ITypelyBuilder builder)
{
builder.OfInt().For("Votes");
builder.OfString().For("Code").Length(4).NotEqual("0000");
builder.OfString()
.For("UserId")
.WithNamespace("UserAggregate")
.WithName("Owner identifier")
.NotEmpty()
.NotEqual("0").WithMessage("{Name} cannot be equal to {ComparisonValue}.").WithErrorCode("ERR001")
.MaxLength(20);
builder.OfString()
.For("Monday")
.AsClass()
.WithName(() => LocalizedNames.Moment)
.MinLength(1).WithMessage(() => LocalizedMessages.MinLengthCustom)
.MaxLength(20).WithMessage(() => LocalizedMessages.MaxLengthCustom);
}
}
Documentation
Prerequisites
- Supported .NET versions
- .NET 7.0 and greater
Getting started
Install packages
dotnet add package Typely.Core
dotnet add package Typely.Generators
Create a class inheriting from ITypelySpecification
public class TypesSpecification : ITypelySpecification
{
public void Create(ITypelyBuilder builder)
{
builder.OfString().For("FirstName").NotEmpty();
}
}
Usage
var firstName = FirstName.From("Adam");
FirstName.From(""); //Throws ValidationException
if(!FirstName.TryFrom("value", out FirstName instance, out ValidationError? validationError))
{
// Handle error
}
There are no supported framework assets in this package.
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
- Microsoft.CSharp (>= 4.7.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.8.0 | 106 | 6/9/2024 |
1.7.0 | 1,031 | 10/10/2023 |
1.6.0 | 1,057 | 10/9/2023 |
1.5.0 | 1,286 | 5/10/2023 |
1.4.6-alpha | 1,041 | 5/2/2023 |
1.4.5-alpha | 1,359 | 5/1/2023 |
1.4.4-alpha | 1,278 | 5/1/2023 |
1.4.3-alpha | 1,083 | 4/28/2023 |
1.4.2-alpha | 1,360 | 4/28/2023 |
1.4.1-alpha | 1,260 | 4/26/2023 |
1.4.0-alpha | 1,187 | 4/23/2023 |
1.3.2-alpha | 1,022 | 4/23/2023 |
1.3.1-alpha | 1,120 | 4/19/2023 |
1.3.0-alpha | 1,017 | 4/19/2023 |
1.2.0-alpha | 1,051 | 4/16/2023 |
1.1.0-alpha | 1,144 | 4/16/2023 |
0.1.0-alpha | 1,203 | 1/16/2023 |