clsContext¶
clsContext is the named key/value context bag every clsModelBase carries, combining well-known typed properties (claimId, policyNum, SAIFClaimNum, ProviderLocationSeqNum) with a generic string GetContext/SetContext store, the established clsSecurityPrincipal, and the SQL Server-backed repository (its private nested clsContextRepository) that transfers context values between SAIF applications during cross-application navigation. It is the object Persist context rows and Retrieve and consume context rows operate on, and its UserID property is the source of the identity used to load a user's authorized menu (BR-MVC-015).
Purpose¶
- Holds the current security principal and well-known screen fields (claim, policy, provider-location identifiers) shared across a screen's model and controller.
- Provides a generic string key/value store (
GetContext/SetContext) for arbitrary context values a screen or the navigation pipeline needs to carry. - Persists, retrieves, and deletes context rows in the SQL Server
Contexttable so a value set in one SAIF application can be read by another after a cross-application navigation (BR-MVC-010, BR-MVC-017). - Derives the authorization identity (
UserID) used to load a user's authorized menu set, from the establishedSecurityPrincipal.
Context¶
- Namespace:
SAIF.Presentation.Web.MVC* - Assembly/package:
SAIF.Presentation.Web.MVC
Public members¶
| Member | Signature | Purpose |
|---|---|---|
claimId |
Public Property claimId() As Decimal |
Well-known context field carrying the current claim identifier |
policyNum |
Public Property policyNum() As Integer |
Well-known context field carrying the current policy number |
SAIFClaimNum |
Public Property SAIFClaimNum() As String |
Well-known context field carrying the SAIF-formatted claim number |
ProviderLocationSeqNum |
Public Property ProviderLocationSeqNum() As Integer |
Well-known context field carrying a provider location sequence number |
SecurityPrincipal |
Public Property SecurityPrincipal() As clsSecurityPrincipal |
The authenticated identity established for the current request by clsControllerBase.SecurityCheck |
UserName |
Public ReadOnly Property UserName() As String |
Legacy accessor for the current user's name, derived from SecurityPrincipal |
UserID |
Public ReadOnly Property UserID() As String |
Returns SecurityPrincipal.UserName.ToUpper(), or an empty string when no principal is set; the identity used to load the authorized menu set (BR-MVC-015) |
GetContext |
Public Function GetContext(ByVal key As String) As String |
Reads a generic named context value previously set with SetContext |
SetContext |
Public Sub SetContext(ByVal key As String, ByVal value As String) |
Writes a generic named context value into the in-memory context bag |
ApplicationName |
Friend Property ApplicationName() As String |
The application name this context belongs to; set by the controller during model construction |
RetrieveContext |
Protected Friend Function RetrieveContext(ByVal SourceAppName As String, ByVal CurrentAppName As String, ByVal inSessionID As String) As Hashtable |
Reads and deletes the source application's saved context rows for this session, returning them as a hashtable; see Retrieve and consume context rows |
SaveContext |
Protected Friend Sub SaveContext(ByVal inSessionID As String) |
Replaces this application/session's context rows with the current in-memory context values; see Persist context rows |
GetPID |
Protected Friend Function GetPID(ByVal inSessionID As String, ByVal inContextName As String) As String |
Resolves a single named context value (typically the __SAIFPID view ID) for the current application/session, used to rejoin a request to the correct multi-model instance |
Behavioral notes¶
RetrieveContextandSaveContexteach construct their ownclsContextRepository(a private nested class) and open a dedicatedSqlConnectionper database operation rather than sharing a connection across the call.UserID's dependence onSecurityPrincipalmeans it returns an empty string for any context that has not yet been through a successfulSecurityCheck.
Constraints and usage notes¶
ApplicationName's setter isFriend, so only code within this assembly (the controller, during model/context construction) can change which application a context belongs to.- The private nested
clsContextRepositoryandclsSQLclasses are not part of this type's public surface and are not separately documented in the API reference.
Note: Statements marked with
*were inferred from code structure, naming conventions, or contextual evidence where direct confirmation was not available in source artifacts.
Sources¶
- SAIF.Presentation.Web.MVC/clsContext.vb