Skip to content

DomainBase\<TItem>

DomainBase<TItem> is the root abstraction that every SAIF.Domain wrapper class builds on: it holds the single NHibernate data entity (TItem, constrained to IDataEntity) that a domain type presents behaviour around, and gives every subclass a uniform, null-safe way to ask whether that entity actually has data. Concrete domain types across the library — including query-provider wrappers (DomainQueryBase<TItem,TQueryProvider>) and repository-backed wrappers (DomainRepositoryBase<TItem>) — derive from it rather than holding the entity themselves, so this class defines the common shape those two families extend.

Purpose

  • Owns the single TItem data entity that a domain wrapper exposes behaviour around, so callers work through the domain type rather than the raw NHibernate entity directly.
  • Provides a consistent, null-safe HasData check (based on SAIF.Common IsNull()) so subclasses do not each reimplement entity-presence checks.
  • Establishes the constructor contract (protected DataItem) that DomainQueryBase<TItem,TQueryProvider> and DomainRepositoryBase<TItem> build on for query-provider and repository-factory injection respectively.

Context

  • Namespace: SAIF.Domain
  • Assembly/package: SAIF.Domain (Domain/SAIF.Domain/SAIF.Domain.csproj, .NET Framework 4.6.2 class library)

Public members

Member Signature Purpose
DomainBase (constructor) protected DomainBase(TItem data) Initializes the wrapper with the backing data entity that subclass behaviour operates on.
DomainBase (parameterless constructor) internal DomainBase() Internal-only constructor reserved for framework/test scaffolding*; not intended for library consumers to call directly.
HasData public virtual bool HasData { get; } Reports whether the wrapped entity is present, evaluated as !DataItem.IsNull() so callers can guard behaviour without null-reference risk.
DataItem protected TItem DataItem { get; set; } The backing NHibernate data entity that subclass methods read and mutate to implement domain behaviour.

Behavioral notes

  • HasData is declared virtual, so a subclass can override the presence check if its notion of "has data" differs from simple null-checking*.
  • The parameterless internal DomainBase() constructor bypasses entity assignment entirely; any subclass relying on it must set DataItem itself before use**.

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

  • Domain/SAIF.Domain/DomainBase.cs
  • Domain/SAIF.Domain/SAIF.Domain.csproj