GlobalizationServices¶
GlobalizationServices is a public class in SAIF.Business that generates globalization-aware code-table SQL and loads code/description items for a requested UI culture.
Purpose¶
- Builds
SELECTstatements that join a primary code table to its globalization table. - Applies translated column values when globalization rows exist and falls back to primary-table values when they do not.
- Retrieves code/description pairs for a culture-specific code table lookup.
Context¶
- Namespace:
SAIF.Business - Assembly/package:
SAIF.Business
Public members¶
| Member | Signature | Purpose |
|---|---|---|
GlobalizedCodeTableSql |
Public Shared Function GlobalizedCodeTableSql(inPrimaryTable As String, inPK As List(Of String), inGlobColumns As List(Of String), inColumns As List(Of String), Optional inGlobalTable As String = "", Optional inAdditionalJoinClause As String = "", Optional inAllCodes As Boolean = False) As String |
Builds the globalization-aware SQL statement for a code table using explicit key, translated-column, and pass-through-column lists. |
GlobalizedCodeTableSql |
Public Shared Function GlobalizedCodeTableSql(inPrimaryTable As String, Optional inAllCodes As Boolean = False) As String |
Builds the default globalization SQL for code tables that use Code as the key and Code_Descr as the translated column. |
GetGlobalizedCodeItemCollection |
Public Shared Function GetGlobalizedCodeItemCollection(DPI As IDataPortalInfo, inPrimaryTable As String, Optional ByVal inCultureCode As String = "") As IEnumerable(Of GlobalizedCodeItem(Of String, String)) |
Executes the default globalization query and returns the resulting code/description pairs. |
GetCurrentUICultureCode |
Public Shared Function GetCurrentUICultureCode() As String |
Returns the current UI culture's two-letter ISO language code. |
Behavioral notes¶
- When
inGlobalTableis empty, the SQL builder derives the globalization table name by uppercasing the primary table name and replacing_CODEwith_GCODE. - The generated SQL uses a left outer join on the supplied primary-key columns and always adds
upper(Glob.culture_code) = upper(:CultureCode)to the join clause. - Each translated column is emitted as a
case when Glob.<column> is null then cast( Prim.<column> as nvarchar2(200)) else Glob.<column> endexpression so untranslated values fall back to the primary table. GetGlobalizedCodeItemCollectiondefaultsinCultureCodetoGetCurrentUICultureCode()when the caller supplies an empty value.
Constraints and usage notes¶
- The explicit
GlobalizedCodeTableSqloverload expects callers to supply the primary-key columns, translated columns, and pass-through columns that match the target tables. GetGlobalizedCodeItemCollectionexpects the generated SQL to exposecodeandcode_descrcolumns because those names are hard-coded when materializingGlobalizedCodeItem(Of String, String)objects.- When
inAllCodesisFalse, the generated SQL includes aWHEREclause that binds each primary-key value by name.
Sources¶
Business\SAIF.Business\GlobalizationServices.vb