ApplicationDataAccess¶
ApplicationDataAccess is the data-portal provisioning boundary used by AppManagerBase.DataLayer: it builds clsSQLDataPortal / clsMSOracleDataPortal instances from plain connection properties (DBUser, Database, Server) and registers them in a keyed IDataPortalInfo registry, so a single manager can address multiple databases by name without any manager code composing or issuing SQL itself.
Purpose¶
- Provisions Oracle or SQL Server data portals (BR-APP-007, BR-APP-008) from connection properties supplied by the caller.
- Attributes the database session to the authenticated user by default, while allowing a batch process to substitute a service identity via
BatchID(BR-APP-007). - Guards the portal registry so that only
AppManagerBase.InjectDPI(same assembly) can register a handle from outside this class itself.
Context¶
- Namespace:
SAIF.Application - Assembly/package:
SAIF.Application(embedded, ProjectReference)
Public members¶
| Member | Signature | Purpose |
|---|---|---|
New |
Public Sub New(Optional inBatchUserID As String = "") |
Creates the underlying clsDataAccess and clsEnvironment; a non-blank batch user id becomes the DAL client id, otherwise the DAL's own client id is used. |
DBUser |
Public Property String |
DB user portion of the connection environment used when building either portal type. |
Database |
Public Property String |
Database/service name portion of the connection environment. |
Server |
Public Property String |
Server portion of the connection environment, used only by CreateSQLServerPortal. |
BatchID |
Public Property String |
Overrides the environment ClientID when non-blank, letting a batch process substitute a service identity for the authenticated user (BR-APP-007). |
DAL |
Public ReadOnly Property As IDataAccess |
Exposes the underlying data-access object to the owning manager. |
DPI(inKey) |
Public Property (get) / Friend Set |
Keyed registry of IDataPortalInfo handles; keys are lower-cased. The setter is Friend, so only this assembly (via AppManagerBase.InjectDPI) can register a handle from outside this class. |
CreateSQLServerPortal |
Public Sub (inKey As String) |
Builds a clsSQLDataPortal from the current environment properties, sets DBMSType to SqlServer, and registers the returned DPI under inKey (BR-APP-008). |
CreateOraclePortal |
Public Sub (inKey As String) |
Builds a clsMSOracleDataPortal from the current environment properties, sets DBMSType to Oracle, and registers the returned DPI under inKey (BR-APP-008). |
Behavioral notes¶
ClientIDis seeded from the DAL's client id, then overwritten withBatchIDwhenBatchID.Trim.Length > 0(BR-APP-007).- Re-using a key through
CreateOraclePortal/CreateSQLServerPortalraises anArgumentException(SortedList.Addsemantics), while re-registering the same key through theDPIsetter (i.e. viaInjectDPI) is silently ignored — the first registration wins (BR-APP-008). m_DAL,m_Env, andm_DPILibraryare<NonSerialized()>, so a deserialized instance retains only the connection strings/ids and must be re-initialized before portal creation.*- No SQL is authored or issued anywhere in this type — it only establishes connection context for the business layer that later holds the portal handle.
Constraints and usage notes¶
- The
BatchIDproperty has no guard and is freely settable by any caller; this is an impersonation-for-auditing mechanism only and does not affect AD authorization. - External callers cannot register a DPI handle directly through the
DPIsetter (it isFriend); they must go throughCreateOraclePortal/CreateSQLServerPortal, or through a derived manager'sInjectDPIcall.
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.Application/ApplicationDataAccess.vbSAIF.Application/AppManagerBase.vb