Skip to content

DomainQueryBase\<TItem, TQueryProvider>

DomainQueryBase<TItem, TQueryProvider> extends DomainBase<TItem> to add a second collaborator alongside the wrapped entity: a SAIF.Data query-provider instance (TQueryProvider, constrained to SAIF.Data.Queries.IQueryProvider) that read-oriented domain wrappers use to fetch related data. It exists so that domain types whose behaviour is primarily about querying — rather than persisting — data have a standard place to receive and store their query-provider dependency, keeping that concern separate from the repository-factory pattern used by DomainRepositoryBase<TItem>.

Purpose

  • Adds query-provider injection (QueryProvider) to the base entity-wrapping contract from DomainBase<TItem>, so subclasses that need to run SAIF.Data queries receive that dependency uniformly through the constructor.
  • Supplies constructor overloads that accept the query provider alone, the data entity alone, or both together, so subclasses can be built whether or not an entity is already known at construction time.

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
DomainQueryBase (constructor) protected DomainQueryBase(TQueryProvider provider) Initializes the wrapper with the query provider used to fetch related domain data, without an existing data entity.
DomainQueryBase (constructor) protected DomainQueryBase(TItem data) : base(data) Initializes the wrapper with a known data entity when no query provider is needed at construction.
DomainQueryBase (constructor) protected DomainQueryBase(TQueryProvider provider, TItem data) : base(data) Initializes the wrapper with both the query provider and the backing data entity in one call.
DomainQueryBase (parameterless constructor) internal DomainQueryBase() Internal-only constructor reserved for framework/test scaffolding*; not intended for library consumers to call directly.
QueryProvider protected TQueryProvider QueryProvider The injected SAIF.Data query-provider instance that subclass methods use to look up related entities.

Inherited public members

Members in this section are inherited from DomainBase<TItem> in SAIF.Domain. They are available on this type through inheritance.

Member Signature Purpose Origin
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. SAIF.Domain — DomainBase<TItem>
DataItem protected TItem DataItem { get; set; } The backing NHibernate data entity that subclass methods read and mutate to implement domain behaviour. SAIF.Domain — DomainBase<TItem>

Behavioral notes

  • The parameterless internal DomainQueryBase() constructor bypasses both the entity and query-provider assignment; any subclass relying on it must set both DataItem and QueryProvider 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/DomainQueryBase.cs
  • Domain/SAIF.Domain/DomainBase.cs
  • Domain/SAIF.Domain/SAIF.Domain.csproj