Skip to content

SQL-MVC-004: Delete context rows

Deletes all Context rows for a given application and session. This statement is invoked from two call sites: (a) inside clsContext.RetrieveContext, immediately after SQL-MVC-002's read, to consume/clear the handed-off context rows for the source application and session; and (b) inside clsContext.SaveContext, executed before the loop of inserts (SQL-MVC-001) to clear any prior rows for the current application and session before re-saving — a delete-then-reinsert ("upsert via replace") pattern.

Classification

Field Value
SQL ID SQL-MVC-004
Operation type Delete
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.Delete(inAppName, inSessionID) — called from clsContext.RetrieveContext and clsContext.SaveContext

Parameters

Parameter Direction Type Max length Description
@AppName Input SqlDbType.VarChar 50 Application name whose context rows are removed; bound from inAppName.
@SessionID Input SqlDbType.VarChar 50 Session identifier whose context rows are removed; bound from inSessionID.

Tables

Table Access Columns used
Context DELETE AppName, SessionID

Sample SQL

-- Delete all context rows for the given application and session
Delete Context
Where
AppName = @AppName and SessionID = @SessionID

Operations and processes

Business rules

No contention/rowcount validation exists after the delete in either call path.

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

Sources

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