DcsvIo.D2.Utilities
0.1.1
dotnet add package DcsvIo.D2.Utilities --version 0.1.1
NuGet\Install-Package DcsvIo.D2.Utilities -Version 0.1.1
<PackageReference Include="DcsvIo.D2.Utilities" Version="0.1.1" />
<PackageVersion Include="DcsvIo.D2.Utilities" Version="0.1.1" />
<PackageReference Include="DcsvIo.D2.Utilities" />
paket add DcsvIo.D2.Utilities --version 0.1.1
#r "nuget: DcsvIo.D2.Utilities, 0.1.1"
#:package DcsvIo.D2.Utilities@0.1.1
#addin nuget:?package=DcsvIo.D2.Utilities&version=0.1.1
#tool nuget:?package=DcsvIo.D2.Utilities&version=0.1.1
DcsvIo.D2.Utilities
Foundational helpers used at every boundary across D2. The "no value too small to centralize" library — preventing whole classes of bugs (empty-string-as-data, env-var collisions, JSON cycles) from ever entering domain code.
Runtime dependencies are kept minimal so this lib stays domain-safe:
dotenv.net— only loaded whenD2Env.Load()is calledJetBrains.Annotations— compile-time markersDcsvIo.D2.Result+DcsvIo.D2.I18n.Abstractions— both zero-runtime-dep themselves; pulled in soTryParseEmail/TryParsePhoneNumbercan returnD2Result<string>withTK.*-keyed messages
Install
dotnet add package DcsvIo.D2.Utilities
Public API (by concern)
| Concern | Covers |
|---|---|
Attributes |
[RedactData] marker attribute consumed by the Serilog destructuring policy. |
Configuration |
ConnectionStringHelper (URI ↔ wire-format conversion for Redis / Postgres / RabbitMQ) + D2Env (host-side .env* file loader). |
Diagnostics |
SanitizedExceptionRender — PII-safe exception rendering for log + telemetry + DLQ-header surfaces. |
Enums |
IsolationLevel (SQL transaction isolation taxonomy) + RedactReason (closed enum used by [RedactData]). |
Extensions |
The most-used surface: Truthy() / Falsey() / ToNullIfEmpty() boundary checks; ThrowIfFalsey() required-argument guards (BCL-split null vs falsey); TryParseTruthyNull Guid + enum parsers; CleanStr / CleanDisplayStr display cleaners; TryParseEmail / TryParsePhoneNumber D2Result-returning validators; GetNormalizedStrForHashing; NormalizeForHash (single-value cross-script hash canonicalization); Clean() for enumerables. |
Serialization |
SerializerOptions — frozen JsonSerializerOptions presets (SR_IgnoreCycles, SR_Web, SR_WebIgnoreNull). |
Adversarial coverage notes
Public surfaces are covered adversarially across every boundary helper, including:
- All
Truthy/Falseyoverloads — null, empty, whitespace-only, multi-element, boundary values. ToNullIfEmpty— null/empty/whitespace/trim/identity paths.CleanStr/CleanDisplayStr— Unicode multi-script preservation, allowed-char retention, all-stripped → null.TryParseEmail/TryParsePhoneNumber— happy paths + documented failure conditions; assertsD2Result.IsValidationFailedand the carriedTK.Common.Validation.EMAIL_INVALID/PHONE_INVALIDkey.GuidExtensions.TryParseTruthyNull/EnumExtensions.TryParseTruthyNull<TEnum>— happy path + adversarial coverage.GetNormalizedStrForHashing/NormalizeForHash— empty, multi-script, idempotency, determinism.EnumerableExtensions.Clean— empty-behavior × value-null-behavior matrix.RedactDataAttribute— defaults, init-only setters, reflective discovery.SerializerOptions— camelCase, string-enums, null preservation/omission, cycle tolerance.ConnectionStringHelper/D2Env— URI conversion, env-var resolution, discovery precedence.SanitizedExceptionRender— type-name fallback, first-frame format, anti-leak invariants (rendered strings never containException.Message).
| 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
- DcsvIo.D2.I18n.Abstractions (>= 0.1.1)
- DcsvIo.D2.I18n.Keys (>= 0.1.1)
- DcsvIo.D2.Result (>= 0.1.1)
- dotenv.net (>= 4.0.2)
- JetBrains.Annotations (>= 2025.2.4)
NuGet packages (24)
Showing the top 5 NuGet packages that depend on DcsvIo.D2.Utilities:
| Package | Downloads |
|---|---|
|
DcsvIo.D2.Auth.Abstractions
Identity and authorization vocabulary plus consumer-side runtime contracts for D2 inbound auth — value types, constants, and read-only interfaces. |
|
|
DcsvIo.D2.Time
Deterministic timestamp handling for D2 — a dependency-injected clock seam, temporal storage types, and NodaTime to PostgreSQL EF Core wiring. |
|
|
DcsvIo.D2.AuthContext.Abstractions
Read-only IAuthContext interface for reasoning about caller identity, organization, scopes, and impersonation context in D2. |
|
|
DcsvIo.D2.Context.Abstractions
Spec-driven request-context primitives for D2 — IRequestContext, MutableRequestContext, and the cross-hop propagation codecs. |
|
|
DcsvIo.D2.Geo.Abstractions
Strongly-typed ISO geo reference-data type surface for D2 (countries, subdivisions, currencies, languages, locales, timezones) without catalog data. |
GitHub repositories
This package is not used by any popular GitHub repositories.