Skip to content

SQL-MVC-001: Insert context value

Persists a single cross-application context key/value pair (e.g., claim ID, policy number) for the current application and session into the Context table. clsContext.SaveContext calls this once per key in m_AppVars, after first deleting any prior rows for the same application/session via SQL-MVC-004 (a delete-then-reinsert "upsert via replace" pattern).

Classification

Field Value
SQL ID SQL-MVC-001
Operation type Create
Execution method Inline SQL (SqlCommand.ExecuteNonQuery)
Database SQL Server (catalog NETFRAMEWORK)
Schema [unqualified]**
Command type Text
Business object N/A (Application layer)
Criteria property N/A (Application layer)
Lifecycle method N/A (Application layer)
Application class clsContext.clsContextRepository.Save(inAppName, inSessionID, inContextName, inContextValue)

Parameters

Parameter Direction Type Max length Description
@AppName Input SqlDbType.VarChar 50 Application name owning the context row; bound from inAppName.
@SessionID Input SqlDbType.VarChar 50 ASP.NET session identifier the context value belongs to; bound from inSessionID.
@ContextName Input SqlDbType.VarChar 50 Name/key of the context variable being persisted; bound from inContextName.
@ContextValue Input SqlDbType.VarChar 256 String value of the context variable; bound from inContextValue.

Note: the SQL text supplies 5 values but only 4 parameters are bound — the 5th column value is the literal CURRENT_TIMESTAMP, populating the UpdateDate column with the server's current timestamp at insert time (not a bound parameter).

Tables

Table Access Columns used
Context INSERT AppName, SessionID, ContextName, ContextValue, UpdateDate (via CURRENT_TIMESTAMP)

Sample SQL

-- Insert one context key/value row for the current application/session
Insert into Context
Values
(@AppName, @SessionID, @ContextName, @ContextValue, CURRENT_TIMESTAMP)

Operations and processes

Business rules

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

Sources

  • SAIF.Presentation.Web.MVC\clsContext.vb