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, aValidationResult/ValidationFailure/SaifValidationExceptionvalidation model,ContextExceptionand its four subclasses, and aSequenceGenerator<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
.csprojhas 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, genericT,IComparable,IEnumerable<T>, numeric types,IIdentity,byte[], andUri(Extensionsnamespace). - Provide static helper classes:
DateMaker(EDI-style date strings),Enforce(argument guard clauses),Julian(Julian-date conversions), andReflector(property-info reflection) (Helpersnamespace). - Provide a validation-result model (
ValidationResult,ValidationFailure) andSaifValidationExceptionfor surfacing validation failures to callers. - Provide MVC-oriented context exception types (
ContextExceptionand its four subclasses) whoseTargetViewvalues 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, andReflector— 4 public static helper classes, plus the internal marker attributeValidatedNotNullAttributeused only as a code-analysis hint onEnforce.ArgumentNotNull.InternalUtility.TitleCase: aninternalengine class that backsStringExtensions.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'sArchitecture.mddescribes implementation libraries as referencing "ServiceContracts(and sometimesCommon)". No.csprojundersrc/in this repository currently referencesSAIF.NetCore.Common, so the observed state matches the README, and the "sometimes" wording inArchitecture.mdcould 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 inArchitecture.md. - Nearly every helper and extension class is
staticand stateless, with one documented exception:DateRange.Emptyis a shared static instance whoseBeginDate/EndDatehave public setters, so any consumer that mutates it changes the value process-wide.* - Several members read
DateTime.Now/DateTime.Todayor the current thread culture directly, so their results depend on server clock, time zone, and locale (see Architecture).
Related documentation¶
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.csprojsrc/SAIF.NetCore.Common/README.mdArchitecture.md