Skip to content

SAIF.NetCore.Common overview

Documentation context: Packaged Component (NuGet)

SAIF.NetCore.Common is a foundation-layer, general-purpose utility library for the Framework.NCore mono-repo: it provides stateless string, date, date-range, collection, byte, URI, and identity extension methods, argument-guard helpers, a validation-result model, MVC-oriented context exception types, and sequence-generator value types, with zero SAIF package dependencies and zero third-party package dependencies.

Purpose

  • Provide reusable, dependency-free BCL-type extensions and helpers that any SAIF application or library can call for string manipulation, date/date-range evaluation, byte-array search, dictionary merging, enumerable operations, numeric parsing, URI parsing, and Windows identity parsing.
  • Provide a small set of value and exception types — DateRange/NullableDateRange, a ValidationResult/ValidationFailure/SaifValidationException validation model, ContextException and its four subclasses, and a SequenceGenerator<T> hierarchy (LongSequence, Sequence) — for consumers that need these shared shapes without a heavier dependency.
  • Sit at the very bottom of the dependency graph: the .csproj has no <PackageReference> and no <ProjectReference> elements, and no library currently present in this repository references it.*

Responsibilities

  • Declare extension methods for string, bool, DateTime, DateRange, IDictionary, Exception, Expression, Stream, generic T, IComparable, IEnumerable<T>, numeric types, IIdentity, byte[], and Uri (Extensions namespace).
  • Provide static helper classes: DateMaker (EDI-style date strings), Enforce (argument guard clauses), Julian (Julian-date conversions), and Reflector (property-info reflection) (Helpers namespace).
  • Provide a validation-result model (ValidationResult, ValidationFailure) and SaifValidationException for surfacing validation failures to callers.
  • Provide MVC-oriented context exception types (ContextException and its four subclasses) whose TargetView values imply ASP.NET MVC view-routing intent in consuming applications.*
  • Provide shared enums (ContiguousOptions, DateRangeOverlapResult, IncludeComparisons, LogType, OverlappingDateOptions), several of which duplicate nested enums declared on the extension classes themselves.

Key components

  • Extensions: 15 static extension classes, each scoped to one BCL type or concern.
  • Helpers: DateMaker, Enforce, Julian, and Reflector — 4 public static helper classes, plus the internal marker attribute ValidatedNotNullAttribute used only as a code-analysis hint on Enforce.ArgumentNotNull.
  • InternalUtility.TitleCase: an internal engine class that backs StringExtensions.ToTitleCase; it is not part of the public surface.
  • Types: 14 public types covering exception hierarchies, date-range value types, an empty placeholder (EntityBase<TEntity>), and the sequence-generator hierarchy.
  • Enums: 5 top-level enums, three of which (ContiguousOptions, IncludeComparisons, OverlappingDateOptions) are shadowed by functionally identical enums declared elsewhere in the assembly and are not bound by the library's own call sites.*
  • The library's own README (src/SAIF.NetCore.Common/README.md) states this package "should never be a dependency of the NetCore.Services packages", but the repository's Architecture.md describes implementation libraries as referencing "ServiceContracts (and sometimes Common)". No .csproj under src/ in this repository currently references SAIF.NetCore.Common, so the observed state matches the README, and the "sometimes" wording in Architecture.md could not be confirmed against any concrete consumer in this repository.**
  • No project references between libraries in this repository touch SAIF.NetCore.Common; it takes zero package references of any kind, SAIF or third-party, consistent with its foundation-layer, zero-dependency position in Architecture.md.
  • Nearly every helper and extension class is static and stateless, with one documented exception: DateRange.Empty is a shared static instance whose BeginDate/EndDate have public setters, so any consumer that mutates it changes the value process-wide.*
  • Several members read DateTime.Now/DateTime.Today or the current thread culture directly, so their results depend on server clock, time zone, and locale (see Architecture).

Note: Statements marked with * were inferred from code structure, naming conventions, or contextual evidence where direct confirmation was not available in source artifacts. Statements marked with ** could not be confirmed; treat as unknown until verified.

Sources

  • src/SAIF.NetCore.Common/SAIF.NetCore.Common/SAIF.NetCore.Common/SAIF.NetCore.Common.csproj
  • src/SAIF.NetCore.Common/README.md
  • Architecture.md