ActDim.Practix.Common
1.0.0
See the version list below for details.
dotnet add package ActDim.Practix.Common --version 1.0.0
NuGet\Install-Package ActDim.Practix.Common -Version 1.0.0
<PackageReference Include="ActDim.Practix.Common" Version="1.0.0" />
<PackageVersion Include="ActDim.Practix.Common" Version="1.0.0" />
<PackageReference Include="ActDim.Practix.Common" />
paket add ActDim.Practix.Common --version 1.0.0
#r "nuget: ActDim.Practix.Common, 1.0.0"
#:package ActDim.Practix.Common@1.0.0
#addin nuget:?package=ActDim.Practix.Common&version=1.0.0
#tool nuget:?package=ActDim.Practix.Common&version=1.0.0
ActDim.Practix.Common
ActDim.Practix.Common provides shared utilities, concurrent collection factories, caching proxies, compression helpers, memory buffer management, and Microsoft Dependency Injection extensions for the ActDim.Practix framework.
Features
- Ambient Context Management:
AmbientContextandAmbientContextProviderfor managing ambient variable states across asynchronous execution flows (AsyncLocal<T>). - Caching Proxies:
MemoryCachingProxyandDistributedCachingProxyoffering simplified, resilient access toIMemoryCacheandIDistributedCache. - Stream & Payload Compression:
CompressionManagerforGZip,BZip2, andZLibbuffer/stream compression. - High-Performance Collections:
ConcurrentFactoryDictionary(thread-safe lock-free lookup/factory pattern),WeakTable<K, V>, andCompositeKey. - Memory Buffer Pooling: Zero-allocation buffer management with
ArrayPoolBufferOwnerandMemoryManager. - Utility & Type Extensions: Extension methods for
Encoding,ArraySegment,Stream,String,Enumerable,Task, andGuardclauses. - Granular Microsoft DI Extensions: Modular registration helpers (
AddAmbientContext(),AddCompressionManager(),AddMemoryCachingProxy(),AddDistributedCachingProxy()).
Installation
Install via the .NET CLI:
dotnet add package ActDim.Practix.Common
Or via Package Manager Console:
Install-Package ActDim.Practix.Common
Dependency Injection Setup
Register components with Microsoft Dependency Injection (IServiceCollection):
using ActDim.Practix.Common.Extensions;
using Microsoft.Extensions.DependencyInjection;
public void ConfigureServices(IServiceCollection services)
{
// Register ambient context provider
services.AddAmbientContext();
// Register compression manager
services.AddCompressionManager();
// Register memory and distributed caching proxies
services.AddMemoryCachingProxy();
services.AddDistributedCachingProxy();
}
Quick Start Examples
1. Concurrent Factory Dictionary
using ActDim.Practix.Collections.Concurrent;
var cache = new ConcurrentFactoryDictionary<string, UserProfile>(
key => FetchUserProfileFromDatabase(key),
StringComparer.OrdinalIgnoreCase
);
// Returns existing item or executes factory thread-safely
UserProfile profile = cache.GetOrAdd("user_42");
2. Compression Manager
using ActDim.Practix.Abstractions.Compression;
using ActDim.Practix.Common.Extensions;
using Microsoft.Extensions.DependencyInjection;
var compression = serviceProvider.GetRequiredService<ICompressionManager>();
byte[] originalData = System.Text.Encoding.UTF8.GetBytes("Payload data to compress");
byte[] compressedData = compression.Compress(originalData, CompressionFormat.GZip);
byte[] decompressedData = compression.Decompress(compressedData, CompressionFormat.GZip);
3. Ambient Context
using ActDim.Practix.Abstractions.Context;
using ActDim.Practix.Common.Extensions;
using Microsoft.Extensions.DependencyInjection;
var contextProvider = serviceProvider.GetRequiredService<IAmbientContextProvider>();
var context = contextProvider.Current;
using (context.PushProperty("TenantId", "acme_corp"))
{
// Operation logic executing inside tenant context
}
License
This project is licensed under the MIT License.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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
- ActDim.Practix.Abstractions (>= 1.0.0)
- Ardalis.GuardClauses (>= 5.0.0)
- Microsoft.Extensions.Caching.Memory (>= 10.0.10)
- Microsoft.IO.RecyclableMemoryStream (>= 3.0.1)
- System.Runtime.Caching (>= 10.0.10)
NuGet packages (3)
Showing the top 3 NuGet packages that depend on ActDim.Practix.Common:
| Package | Downloads |
|---|---|
|
ActDim.Practix.Json
High-performance JSON serialization subsystem for ActDim.Practix backed by System.Text.Json. |
|
|
ActDim.Observability
OpenTelemetry-centric observability and ambient telemetry context framework for .NET applications. |
|
|
ActDim.Reflectron
High-performance reflection engine providing compiled expression tree property getters, setters, and object accessors. |
GitHub repositories
This package is not used by any popular GitHub repositories.