Skip to content

SAIF.Framework.CodeGen business rules

This page captures business rules enforced by SAIF.Framework.CodeGen.

BR-001: Enum member identifiers must be unique within a generated block

Field Value
Statement Enum member identifiers must be unique within a generated block
Trigger Two or more table rows resolve to the same computed identifier
Enforcement CreateCaseStatement/CreateEnumStatement: If (enumValues.ContainsKey(enumValue)) Then enumValue += row("code").ToString
Outcome The row's raw code value is appended to the identifier to disambiguate before emission
Tables CODE_TABLE (caller-supplied)
SQL SQL-001
Source SAIF.Framework.CodeGen\CodeTableMap.vb

Field Value
Statement Generated enum-member identifiers must be legal VB identifiers (cannot start with a digit)
Trigger GetEnumValue computes a candidate identifier that is purely numeric
Enforcement GetEnumValue: If (IsNumeric(enumValue)) Then enumValue = "Code" & enumValue
Outcome Identifier is prefixed with the literal string "Code"
Tables CODE_TABLE (caller-supplied)
SQL SQL-001
Source SAIF.Framework.CodeGen\CodeTableMap.vb

BR-003: Enum-member identifier derivation strips non-alphabetic characters from the description

Field Value
Statement Enum-member identifier derivation strips non-alphabetic characters from the description
Trigger useDescriptionAsCode = True (the default)
Enforcement GetEnumValue: Text.RegularExpressions.Regex.Replace(row("code_descr").ToString, "[^a-zA-Z]", "", ...)
Outcome Only letters are retained from code_descr to form the identifier; when useDescriptionAsCode = False, the raw code value is used instead
Tables CODE_TABLE (caller-supplied)
SQL SQL-001
Source SAIF.Framework.CodeGen\CodeTableMap.vb

BR-004: Data connection is only re-established when parameters change

Field Value
Statement Data connection is only re-established when parameters change
Trigger Connect is called again on an already-connected CodeTableMap instance
Enforcement Connect: compares m_dpi.Database <> database Or m_dpi.dbUser <> dbUser before reconnecting
Outcome Avoids redundant clsMSOracleDataLayer construction when the same database/user pair is reused
Source SAIF.Framework.CodeGen\CodeTableMap.vb

Notes

  • No callers of CodeTableMap exist anywhere in this repository, so the real-world invocation context for these rules (console tool, IDE custom-tool, or manual developer use) could not be confirmed**.
  • Public Enum CodeBlockType (CaseStatement, EnumStatement) is defined but is not referenced by any live code enforcing these rules; its intended consumer is unknown**.

Note: Statements marked with ** could not be confirmed; treat as unknown until verified.

Sources

  • SAIF.Framework.CodeGen\CodeTableMap.vb