Skip to content

SAIF.Resources architecture

SAIF.Resources is a passive shared resource layer that centralizes localized strings, text-template loading, token replacement, and a small reflection-based mapping helper for downstream SAIF applications.

Responsibilities

  • Provide strongly typed resource accessors for generated .resx files across application, business, common, service, and UI groupings.
  • Provide two resource-loading strategies: filesystem-backed and assembly-embedded.
  • Apply a consistent culture fallback chain and token parsing model across resource loaders.
  • Publish supported-language metadata backed by localized resource strings.
  • Bundle static content assets that downstream applications can consume alongside string resources.

Component boundaries

  • clsResourceManager: owns text state, token parsing, token lookup, and token replacement.
  • clsFileResourceManager: resolves templates from a configured directory path.
  • clsAssemblyResourceManager: resolves templates from an assembly manifest resource stream.
  • mdlLanguages and clsLanguage: expose supported-language constants and localized descriptions.
  • ResourceViewModelMapper: copies matching public properties between instantiated types and can emit VB property declarations.
  • Generated resource classes: expose localized string keys through strongly typed String properties.

Interaction model

Consumers load a template through clsFileResourceManager or clsAssemblyResourceManager, let the shared base class tokenize the content, and then replace named tokens before using the rendered text. Other consumers call generated resource classes directly for localized strings, use mdlLanguages.SupportedLanguages for language metadata, or call ResourceViewModelMapper to project string properties onto another type.

Architecture diagram

The following diagram shows high-level component interactions.

flowchart TD
    Consumer[Consuming SAIF application code] --> FileMgr[clsFileResourceManager]
    Consumer --> AssemblyMgr[clsAssemblyResourceManager]
    FileMgr --> BaseMgr[clsResourceManager]
    AssemblyMgr --> BaseMgr
    FileMgr --> Disk[Filesystem templates]
    AssemblyMgr --> Manifest[Embedded manifest resources]
    Consumer --> ResClasses[Generated resource classes]
    ResClasses --> Resx[.resx resource sets]
    Consumer --> Lang[mdlLanguages / clsLanguage]
    Lang --> CommonUI[Common_UI resources]
    Consumer --> Mapper[ResourceViewModelMapper]

Sequence diagram

The following diagram shows the primary request and replacement sequence.

sequenceDiagram
    participant Caller
    participant Loader as clsFileResourceManager/clsAssemblyResourceManager
    participant Base as clsResourceManager
    Caller->>Loader: LoadResource(name, extension, culture)
    Loader->>Loader: Resolve exact culture resource
    alt Exact culture not found
        Loader->>Loader: Retry with two-letter culture
        Loader->>Loader: Retry without culture suffix
    end
    Loader->>Base: Initialize(text)
    Base->>Base: LoadTokens()
    Caller->>Base: ReplaceToken(tokenName, replacement)
    Base-->>Caller: ReplacedText

Design constraints

  • The project has no ProjectReference dependencies and relies on .NET Framework BCL APIs plus generated resource classes.
  • The culture fallback chain is implemented inside the two concrete resource managers rather than in a separate strategy abstraction.
  • ResourceViewModelMapper only copies properties when both the name and the property type match.
  • The library performs no database access, service calls, or authorization checks in its own code.

Sources

  • Resources\SAIF.Resources\SAIF.BOF.ResourceFiles.vbproj
  • Resources\SAIF.Resources\clsResourceManager.vb
  • Resources\SAIF.Resources\clsFileResourceManager.vb
  • Resources\SAIF.Resources\clsAssemblyResourceManager.vb
  • Resources\SAIF.Resources\clsLanguage.vb
  • Resources\SAIF.Resources\mdlLanguages.vb
  • Resources\SAIF.Resources\Mappings\ResourceViewModelMapper.vb
  • Resources\SAIF.Resources\Common\Common_UI.Designer.vb
  • Resources\SAIF.Resources\Resources\core.js
  • Resources\SAIF.Resources\Resources\user_registrationverification_es.html