Skip to content

SAIF.Framework.CodeGen operations and processes

SAIF.Framework.CodeGen exposes exactly three operations, all owned by the single public class CodeTableMap. One operation prepares the Oracle connection the other two depend on; the remaining two read the same reference-data query and transform its rows into different flavors of VB.NET source text. This page is the operation catalog and cross-operation hub for the library — each operation's detailed, step-by-step logic lives in its own page under operations/.

Operation catalog

Operation Intent Trigger Inputs Outputs Rules Tables SQL
Establish/refresh Oracle data connection Prepare or reuse the Oracle data-portal handle that the two generation operations execute their query through Constructor call, or a later explicit Connect invocation dbUser, database Populated or reused m_dpi As IDataPortalInfo BR-004 — —
Generate VB Case statement block Turn a code table's rows into a Case / Me.Add(...) block a developer can paste into hand-written VB source Caller invokes CreateCaseStatement(...) table, enumName, rowItem, useDescriptionAsCode, tabIndex Generated VB source text BR-001, BR-002, BR-003 CODE_TABLE (caller-supplied) SQL-001
Generate VB Enum member list Turn a code table's rows into a VB Enum member list a developer can paste into hand-written VB source Caller invokes CreateEnumStatement(...) table, enumName, includeNull, useDescriptionAsCode, tabIndex Generated VB source text BR-001, BR-002, BR-003 CODE_TABLE (caller-supplied) SQL-001

Process flow diagram

The following diagram traces a caller's typical path through the library: construct CodeTableMap (which connects), then request either a Case block or an Enum list from the same code-table query.

flowchart TD
    Start([Caller constructs CodeTableMap]) --> Connect[Establish or reuse Oracle data connection]
    Connect --> Choice{Requested output?}
    Choice -->|Case block| QueryCase[Read code-table rows]
    Choice -->|Enum list| QueryEnum[Read code-table rows]
    QueryCase --> CaseLoop[Derive unique VB identifiers<br>and emit Case / Me.Add lines]
    QueryEnum --> EnumNull{includeNull?}
    EnumNull -->|Yes| AddNull[Emit leading Null member]
    EnumNull -->|No| EnumLoop[Derive unique VB identifiers<br>and emit enum-member lines]
    AddNull --> EnumLoop
    CaseLoop --> EndCase([Return Case block text])
    EnumLoop --> EndEnum([Return enum-member text])

Inherited operations and processes

The query-execution steps embedded in the two generation operations originate in base classes and services provided by SAIF.Framework.Core. They are inherited or delegated, not implemented in this library. (The Oracle connection operation delegates separately to SAIF.Framework.Core's data-portal request pipeline; see the > Origin callout on its own page.)

From SqlHelper.ResultSetQuery / IDataPortalInfo (SAIF.Framework.Core)

Operation Intent Provided by Origin Embedded in
Framework data-portal request flow Route the code-table SELECT through the configured Oracle data portal and return the resulting clsResultSet SqlHelper.ResultSetQuery, IDataPortalInfo SAIF.Framework.Core Generate VB Case statement block, Generate VB Enum member list

Origin: This framework operation is defined in SAIF.Framework.Core and its step-by-step logic is embedded inline, with > Origin callouts, in the consuming operation pages listed above.

Database interactions

Both generation operations read the same code table through the same query; neither writes to the database. Per-step SQL and table citations live in each operation's detail page under operations/.

Operation SQL Tables Type
Generate VB Case statement block SQL-001 CODE_TABLE (caller-supplied) Read
Generate VB Enum member list SQL-001 CODE_TABLE (caller-supplied) Read

Failure and edge-case behavior

  • Repeated identifiers are disambiguated by appending the row's raw code value before the line is emitted, so no generated block ever contains two members with the same name (BR-001).
  • Description-derived identifiers strip every non-alphabetic character and are prefixed with Code when the stripped result is purely numeric, keeping every generated member name syntactically legal VB (BR-003, BR-002).
  • A repeated Connect call with the same dbUser and database reuses the existing data portal instead of rebuilding it (BR-004).
  • The shared lookup query is unfiltered and unparameterized: it always reads every code/code_descr row exposed by SQL-001 from CODE_TABLE (caller-supplied) — the only caller-controlled input is the table name itself.
  • An empty result set produces empty generated text for CreateCaseStatement, or text containing only the optional Null member for CreateEnumStatement. Connection failures and query failures are not caught locally, so both propagate directly to the caller.

Sources

  • SAIF.Framework.CodeGen\CodeTableMap.vb
  • SAIF.Framework.Core\V1\DataAccessLayer\SqlHelper.vb
  • SAIF.Framework.Core\V1\DataAccessLayer\MSOracle\MSOracleDataLayer.vb
  • SAIF.Framework.Core\V1\Interfaces\iDataPortalInfo.vb