StrongOf.Domains 2.1.8

Requires NuGet 2.12 or higher.

dotnet add package StrongOf.Domains --version 2.1.8
                    
NuGet\Install-Package StrongOf.Domains -Version 2.1.8
                    
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="StrongOf.Domains" Version="2.1.8" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="StrongOf.Domains" Version="2.1.8" />
                    
Directory.Packages.props
<PackageReference Include="StrongOf.Domains" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add StrongOf.Domains --version 2.1.8
                    
#r "nuget: StrongOf.Domains, 2.1.8"
                    
#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.
#:package StrongOf.Domains@2.1.8
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=StrongOf.Domains&version=2.1.8
                    
Install as a Cake Addin
#tool nuget:?package=StrongOf.Domains&version=2.1.8
                    
Install as a Cake Tool

StrongOf.Domains

Predefined strongly-typed domain models based on StrongOf for common use cases.

The namespace structure is deliberately designed so that namespace names do not collide with common class names you might use in your own codebase (e.g. Address, Person, Network).

Available Domain Types

Namespace Types
StrongOf.Domains.Identity CorrelationId, EntityId, TenantId, Token, Username
StrongOf.Domains.People Age, BirthYear, DateOfBirth, FirstName, FullName, LastName, MiddleName, PhoneNumber
StrongOf.Domains.Postal City, CountryCode, CountryName, HouseNumber, Street, ZipCode
StrongOf.Domains.Geography GeoCoordinate, Latitude, Longitude
StrongOf.Domains.Networking EmailAddress, HostName, HttpMethod, IpAddress, MacAddress, Port, Url
StrongOf.Domains.Finance CurrencyCode, Iban, Percentage
StrongOf.Domains.Commerce Priority, Quantity, Sku
StrongOf.Domains.Localization LanguageCode, Locale, TimeZoneId
StrongOf.Domains.Measurement HeightCm, TemperatureCelsius, WeightKg
StrongOf.Domains.Media ColorHex, FileExtension, FilePath, Isbn, MimeType, Slug
StrongOf.Domains.Software SemVer

Add a single GlobalUsings.cs to your project to avoid per-file using directives:

// GlobalUsings.cs
global using StrongOf.Domains.Identity;
global using StrongOf.Domains.People;
global using StrongOf.Domains.Postal;
global using StrongOf.Domains.Geography;
global using StrongOf.Domains.Networking;
global using StrongOf.Domains.Finance;
global using StrongOf.Domains.Commerce;
global using StrongOf.Domains.Localization;
global using StrongOf.Domains.Measurement;
global using StrongOf.Domains.Media;
global using StrongOf.Domains.Software;

Key Features

  • Format validation via IsValidFormat() for types with format constraints (e.g. EmailAddress, CountryCode, Iban)
  • Safe factory via TryCreate(string?, out T?) - returns false instead of creating an invalid instance
  • Range validation via IsValidRange() for numeric and geographic types
  • Conversion helpers e.g. ToMeters(), ToFahrenheit(), ToKelvin(), ToCultureInfo(), TryGetTimeZone()
  • Case-insensitive equality for CountryCode, CurrencyCode, LanguageCode, Locale, FileExtension, MimeType, HostName, MacAddress

Usage

// Create domain objects
EmailAddress email = new("user@example.com");
bool isValidEmail = email.IsValidFormat();

// Safe factory - does not create an invalid instance
bool created = EmailAddress.TryCreate("bad-input", out EmailAddress? result); // false

CountryCode country = new("US");
CurrencyCode currency = new("USD");
GeoCoordinate berlin = GeoCoordinate.From(52.52m, 13.405m);
bool inRange = berlin.IsValidRange();

// Temperature conversion
TemperatureCelsius temp = new(100m);
decimal fahrenheit = temp.ToFahrenheit(); // 212

Installation

dotnet add package StrongOf.Domains
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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 is compatible.  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 is compatible.  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.  net11.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
2.1.8 72 2/28/2026