Skip to content

CodeTableMap

CodeTableMap is the sole public class in SAIF.Framework.CodeGen. It connects directly to an Oracle data layer, queries a caller-supplied "code table" for code/code_descr reference rows, and generates VB.NET source-code text — either Case statement blocks or Enum member lists — for a developer to paste into hand-written code.

Purpose

  • Owns the Oracle connection lifecycle, SQL execution, and source-text generation for code-table-driven VB source generation.
  • Is a standalone tooling class, not a clsBusinessBase/clsBusinessCollectionBase business object.

Context

  • Namespace: SAIF.Framework.CodeGen
  • Assembly/package: SAIF.Framework.CodeGen (bundled into the SAIF.BOF.Framework NuGet package via the SAIF.Framework.Core nuspec glob)

Public members

Member Signature Purpose
New Public Sub New(dbUser As String, database As String) Constructor; calls Connect to establish the Oracle data-portal connection
CreateCaseStatement Public Function CreateCaseStatement(table As String, enumName As String, rowItem As String, Optional useDescriptionAsCode As Boolean = True, Optional tabIndex As Integer = 0) As String Generates a VB Case statement block from a code table's rows
CreateEnumStatement Public Function CreateEnumStatement(table As String, enumName As String, includeNull As Boolean, Optional useDescriptionAsCode As Boolean = True, Optional tabIndex As Integer = 0) As String Generates a VB Enum member list from a code table's rows
Connect Protected Sub Connect(dbUser As String, database As String) Establishes or refreshes the Oracle data-layer connection (m_dpi); only reconnects when dbUser/database differ from the current connection

Behavioral notes

  • CreateCaseStatement and CreateEnumStatement both call the private GetResult(table) helper, which builds and executes select code, code_descr from {table} via SqlHelper.ResultSetQuery(m_dpi).Execute(sql).
  • The private GetEnumValue helper derives a unique, legal VB identifier from each row's code/code_descr values: it strips non-alphabetic characters from code_descr when useDescriptionAsCode is true (default), prefixes purely numeric identifiers with "Code", and appends the raw code value to disambiguate duplicate identifiers within a generated block — see BR-001, BR-002, and BR-003.
  • Connect only reconstructs clsMSOracleDataLayer when dbUser or database differ from the current connection — see BR-004.
  • No callers of CodeTableMap were found anywhere in this repository; it appears to be invoked interactively/manually rather than as part of any runtime request pipeline**.

Constraints and usage notes

  • The table parameter is interpolated directly into SQL text via String.Format, not passed as a bound parameter; callers are responsible for supplying a valid, trusted table name.
  • Only a read (SELECT) operation is supported; this class has no write/insert/update/delete capability.
  • Requires an Oracle connection reachable via clsMSOracleDataLayer(dbUser, database); no configuration-file-driven connection settings exist in this library.

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

  • SAIF.Framework.CodeGen\CodeTableMap.vb