Faactory.Types
2.0.1
dotnet add package Faactory.Types --version 2.0.1
NuGet\Install-Package Faactory.Types -Version 2.0.1
<PackageReference Include="Faactory.Types" Version="2.0.1" />
<PackageVersion Include="Faactory.Types" Version="2.0.1" />
<PackageReference Include="Faactory.Types" />
paket add Faactory.Types --version 2.0.1
#r "nuget: Faactory.Types, 2.0.1"
#:package Faactory.Types@2.0.1
#addin nuget:?package=Faactory.Types&version=2.0.1
#tool nuget:?package=Faactory.Types&version=2.0.1
.NET Foundation
Small, reusable .NET building blocks.
Faactory.Typesprovides small runtime types and encoding utilities.Faactory.Cachingprovides a typed object cache overIDistributedCache, including negative entries.Faactory.Httpprovides named HTTP clients with object caching and optional request authorization.
Install only the packages you need:
dotnet add package Faactory.Types
dotnet add package Faactory.Caching
dotnet add package Faactory.Http
Runtime types
Unique identifiers
UniqueId generates compact, URL-safe identifiers using cryptographically secure randomness.
string id = UniqueId.New();
// id_fxOniKPDBAktptggIajv5DyIjBUOVx92
string orderedId = UniqueId.NewTimeOrdered();
// id_019c2f72a841_fxOniKPDBAktptggIajv5DyIjBUOVx92
Time-ordered identifiers contain a Unix timestamp in milliseconds followed by the same 32-character random component.
Composite identifiers
CompositeId combines multiple string values into a single reversible, URL-safe identifier.
var id = new CompositeId( [ "tenant", "resource" ] );
var parsed = CompositeId.Parse( id.ToString() );
Duration
Duration represents a non-negative duration with millisecond precision and supports compact values such as 2h30m and 500ms.
var duration = Duration.FromSeconds( 30 );
Duration.TryParse( "2h30m", out var parsed );
Base64 URL encoding
Base64Encoder produces canonical, unpadded Base64URL strings and accepts both standard Base64 and Base64URL input when decoding.
Object caching
Register an IDistributedCache implementation, then add the object cache:
services.AddDistributedMemoryCache();
services.AddDistributedObjectCache( options =>
{
options.DefaultAbsoluteExpiration = TimeSpan.FromMinutes( 1 );
options.DefaultNegativeAbsoluteExpiration = TimeSpan.FromSeconds( 5 );
} );
IObjectCache.GetAsync<T> returns null for a cache miss. A non-null ObjectCacheEntry<T> represents a cached result; IsNegative indicates a cached absence.
var cached = await objectCache.GetAsync<Device>( key, cancellationToken );
if ( cached is not null )
{
return cached.Value;
}
var device = await repository.GetDeviceAsync( id, cancellationToken );
if ( device is null )
{
await objectCache.SetNegativeAsync<Device>( key, cancellationToken: cancellationToken );
return null;
}
await objectCache.SetAsync( key, device, cancellationToken: cancellationToken );
return device;
Use a shared IDistributedCache provider when entries must survive application restarts or be shared between instances.
Cached HTTP clients
Register a named cached client using the normal HttpClient configuration model:
services
.AddCachedHttpClient( "devices", ( serviceProvider, httpClient ) =>
{
httpClient.BaseAddress = new Uri( "https://devices.example/" );
} )
.ConfigureCachedHttpClient( options =>
{
options.TransientNegativeAbsoluteExpirationRelativeToNow =
TimeSpan.FromSeconds( 5 );
} );
Create clients through ICachedHttpClientFactory:
var client = cachedHttpClientFactory.CreateClient( "devices" );
var device = await client.GetAsync<Device>(
$"device:{deviceId}",
$"/api/devices/{deviceId}",
device => device.Enabled,
cancellationToken
);
GetAsync<T> returns a cached value when available. Missing or unacceptable objects are negatively cached. Selected transient HTTP failures are cached briefly; other failures return null without being cached. Cache failures do not prevent the HTTP lookup from succeeding.
Implement IAuthorizationProvider when requests need dynamic authorization. The provider receives the complete HttpRequestMessage and may apply any authorization scheme, header, query value, or signature.
Cached values are shared by cache key. Do not use a cached client for caller-specific responses unless the cache key includes the relevant tenant, user, or authorization scope.
| Product | Versions 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. |
-
net10.0
- No dependencies.
-
net8.0
- No dependencies.
-
net9.0
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Faactory.Types:
| Package | Downloads |
|---|---|
|
Faactory.Channels.Abstractions
Channels |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 2.0.1 | 225 | 8/10/2026 |
| 2.0.0 | 120 | 7/30/2026 |
| 1.9.1 | 270 | 4/30/2026 |
| 1.9.0 | 102 | 4/30/2026 |
| 1.8.1 | 586 | 12/4/2024 |
| 1.8.0 | 179 | 12/3/2024 |
| 1.7.1 | 325 | 3/4/2024 |
| 1.7.0 | 192 | 2/29/2024 |
| 1.6.0 | 6,101 | 8/2/2022 |
| 1.5.2 | 551 | 7/14/2022 |
| 1.5.1 | 3,425 | 4/7/2022 |
| 1.5.0 | 1,156 | 4/7/2022 |
| 1.4.4 | 539 | 8/19/2021 |
| 1.4.3 | 497 | 7/6/2021 |
| 1.4.2 | 465 | 7/6/2021 |
| 1.4.1 | 517 | 7/6/2021 |