Skip to content

OP-007: Insert, update, or delete a stored preference set

SavePreferences is invoked over the PreferenceService route on SAIF.Services.WCF.Services.PreferenceService; this page documents the process end to end, from route dispatch to the message the caller receives.

Field Value
Operation ID OP-007
Trigger Caller invokes SavePreferences over the PreferenceService route.
Entry operation SavePreferences
Owning component SAIF.Services.WCF.Services.PreferenceService.SavePreferences
Inputs Request message parts listed below
Outputs No response payload (void)
Failure behavior Generic SOAP fault, per Faults and error pipeline

Request and response

Direction Element Type Declared in Notes
Request applicationName string BCL (System) Application name portion of the preference key; lower-cased before matching. (Yes)
Request pageName string BCL (System) Page name portion of the preference key; a blank value is normalized to the empty string. (No (default None))
Request user string BCL (System) User whose preferences are written; lower-cased before matching. (Yes)
Request preferences IDictionary<string, string> BCL (System) The preference set to persist; an empty dictionary triggers deletion of an existing record. (Yes)
Request currentUser string BCL (System) Unverified caller-supplied audit value; presence-checked but not authenticated. (Yes)
Response void void n/a (void) Not applicable.

Steps

  1. Enforce.ArgumentNotNullOrEmpty(currentUser, "currentUser") runs before any database work (BR-WCF-007).
  2. On failure: ArgumentNullException, logged and surfaced as a generic SOAP fault.
  3. unitOfWork.Begin() opens the transaction boundary that covers the remaining steps.
  4. Lower-case currentUser into the audit field and re-run QueryPrefs to locate any existing record (BR-WCF-005, BR-WCF-011).
  5. No existing record and a non-empty preferences dictionary: AddPreference builds a Preference (storing a blank page name as null) and calls repository.Add (BR-WCF-008).
  6. Existing record and an empty preferences dictionary: DeletePreference calls repository.Delete (BR-WCF-009).
  7. Existing record and a non-empty dictionary: UpdatePreference repopulates the tracked entity in place (BR-WCF-010); PopulatePreference serializes the dictionary to JSON and stamps UpdateDate = DateTime.Now and UpdateUser = currentUser (BR-WCF-011).
  8. unitOfWork.Commit().
  9. On failure before commit: logged by the installed error handler, surfaced as a generic SOAP fault, and the transaction is rolled back when Dispose runs.

Process flow

The following diagram visualizes this process's control flow.

flowchart TD
    A["Validate currentUser is present"]
    B["Begin transaction"]
    C["Normalize currentUser and<br>locate existing record"]
    C1{"Existing record<br>and preferences dictionary"}
    D["Insert new preference record"]
    E["Delete existing preference record"]
    F["Update existing preference record"]
    G["unitOfWork.Commit()."]
    A --> B
    B --> C
    C --> C1
    C1 -->|"No existing record, non-empty"| D
    C1 -->|"Existing record, empty"| E
    C1 -->|"Existing record, non-empty"| F
    D --> G
    E --> G
    F --> G

Transaction and side effects

Aspect Finding
Unit of work OracleUnitOfWorkFactory (CLM)
Commit point unitOfWork.Commit() after the add/delete/update decision
Records written Preference (insert, update, or delete)
Downstream calls None
Shared state touched None
Repeat-call behavior Re-running with the same arguments reaches the same terminal state (upsert-like)

Logging

Surface Written content
ErrorLogErrorHandler → LogService Failure-path exception logging only, carrying method signature, calling user and exception detail; see Faults and error pipeline

Faults and error handling

Failure Fault type the caller receives Produced by Source
ArgumentNullException (missing currentUser) Generic SOAP fault The operation itself, via Enforce src/WCF/SAIF.Services.WCF.Host/Services/PreferenceService.cs
Oracle/NHibernate exception during commit Generic SOAP fault The ErrorLogErrorHandler installed by [LogErrorBehavior] src/WCF/SAIF.Services.WCF.Host/Services/PreferenceService.cs

Authorization

Requirement Enforced by Source Applies to
None in code IIS authentication on the deployment (see Activation and hosting) src/WCF/SAIF.Services.WCF.Host/Services/PreferenceService.cs This operation

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

  • src/WCF/SAIF.Services.WCF.Host/Services/PreferenceService.cs