Skip to content

SQL-004: Retrieve current server date/time

This statement backs SessionHelperBase.SystemDate, an infrastructure utility consumed by RepositoryBase<TEntity>.SystemDate. The exact text executed is engine-dependent: it is selected at ISessionHelper construction time by which subclass (OracleSessionHelper vs. SqlServerSessionHelper) was built for the active unit of work (Factories/UnitOfWorkFactoryBase.cs::BuildSessionHelper). The getter falls back to local DateTime.Now if the query result is null, DateTime.MinValue, or DateTime.MaxValue — see BR-004.

Classification

Field Value
SQL ID SQL-004
Operation type Read
Execution method Inline SQL (ISessionStrategy.CreateSqlQuery), engine-selected text
Database Oracle / SQL Server (engine-dependent)
Schema [unqualified]**
Command type Text
Business object N/A — infrastructure utility, not tied to a mapped entity
Criteria property N/A — no IBusinessCriteria exists in this library
Lifecycle method SessionHelperBase.SystemDate (get accessor); engine text set in OracleSessionHelper/SqlServerSessionHelper constructors

Parameters

No parameters — both variants are literal, parameterless server-time queries with no bind variables.

Tables

Table Access Columns used
— SELECT (scalar value; Oracle reads the DUAL pseudo-table, SQL Server reads no table) —

Sample SQL

Oracle variant (SessionHelper/OracleSessionHelper.cs):

select sysdate
from dual

SQL Server variant (SessionHelper/SqlServerSessionHelper.cs):

Select GetDate()

Operations and processes

Business rules

  • BR-004 — this statement is the query BR-004 describes; the local-clock fallback behavior in SessionHelperBase.SystemDate's getter is the enforcement point, and this statement is the query it depends on for its primary (non-fallback) result.

Sources

  • SessionHelper/SessionHelperBase.cs
  • SessionHelper/OracleSessionHelper.cs
  • SessionHelper/SqlServerSessionHelper.cs