Typely.Core 0.1.0-alpha

This is a prerelease version of Typely.Core.
There is a newer version of this package available.
See the version list below for details.
dotnet add package Typely.Core --version 0.1.0-alpha
NuGet\Install-Package Typely.Core -Version 0.1.0-alpha
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.Core" Version="0.1.0-alpha" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Typely.Core --version 0.1.0-alpha
#r "nuget: Typely.Core, 0.1.0-alpha"
#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.Core as a Cake Addin
#addin nuget:?package=Typely.Core&version=0.1.0-alpha&prerelease

// Install Typely.Core as a Cake Tool
#tool nuget:?package=Typely.Core&version=0.1.0-alpha&prerelease

Typely

Typerly lets you create types easily with a fluent API to embrace Domain-driven design and value objects.

Example

public class TypesConfiguration : ITypelyConfiguration
{
    public void Configure(ITypelyBuilder builder)
    {
        builder.OfInt().For("Votes");
        builder.OfString().For("Username");
        builder.OfString().For("Code").Length(4).NotEqual("0000");

        // Create a reusable factory
        var sf = builder.OfString().AsFactory();

        sf.For("UserId")
            .WithNamespace("UserAggregate")
            .WithName("Owner identifier")
            .NotEmpty()
            .NotEqual("0").WithMessage("{Name} cannot be equal to {ComparisonValue}.").WithErrorCode("ERR001")
            .MaxLength(20);

        // Simplify configurations of similar types.
        var moment = sf.AsClass()
            .WithName(() => LocalizedNames.Moment)
            .MinLength(1).WithMessage(() => LocalizedMessages.MinLengthCustom)
            .MaxLength(20).WithMessage(() => LocalizedMessages.MaxLengthCustom)
            .AsFactory();

        moment.For("Monday");
        moment.For("Sunday");
    }
}

// Examples of uses:
var code = Code.From("!c9u");
var userId = UserId.From(""); //Throws ValidationException

if(!UserId.TryFrom("value", out Rating instance, out ValidationError? validationError))
{
    // Handle error
}

Why Typely?

  • The entire boiler plate is generated for you. Example here.
    • Supports value comparison with:
      • IEquatable<T>
      • Operators != and ==
    • Support for sorting with:
      • IComparable<T>
      • IComparable
    • Support for creating and validating value objects in a generic way.
    • Typely doesn't use the generic EqualityComparer and is therefore faster than records.
  • Built-in localized validations. You define the rules of the model once.
  • Built-in type conversion.
    • Accept value objects directly in the requests of your APIs.
      • No need to manually create theses objects.
      • No need to validate theirs values because they can only be created if they are valid.
    • Save or read your value objects to or from the database without effort.
  • Lets you extend your value objects easily:
    • With the use of the interface ITypelyValue<TValue, TThis>
    • Or by creating a partial class of the same name and type.
Product 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 is compatible.  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. 
.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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.0

    • No dependencies.
  • net7.0

    • No dependencies.

NuGet packages (3)

Showing the top 3 NuGet packages that depend on Typely.Core:

Package Downloads
Typely.AspNetCore.Swashbuckle

Package Description

Typely.AspNetCore

Package Description

Typely.EfCore

Typely: Unleashing the power of value object creation with a fluent Api. This package contains integrations with EF Core.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.3.0 604 5/10/2023
1.2.5-alpha 480 4/28/2023
1.2.4-alpha 439 4/28/2023
1.2.3-alpha 435 4/26/2023
1.2.2-alpha 483 4/23/2023
1.2.1-alpha 394 4/19/2023
1.2.0-alpha 1,376 4/16/2023
1.1.0-alpha 1,464 4/15/2023
1.0.0-alpha 408 4/15/2023
0.1.2-alpha 401 1/18/2023
0.1.1-alpha 611 1/18/2023
0.1.0-alpha 390 1/16/2023