Skip to content

Model write pipeline

clsModelBase.Write() is a template method that guarantees WriteData() is only invoked when ValidateData() succeeds. Both methods are abstract (MustOverride) and implemented entirely by the concrete model in each consuming application — this library only enforces the ordering contract.

Field Value
Operation ID OP-MVC-004
Trigger Explicit call to clsControllerBase.Write() (which calls Model.Write()), typically on a save postback
Inputs Model's in-memory state, populated by the concrete Retrieve implementation
Outputs Boolean success
Primary components clsModelBase.Write, clsControllerBase.Write
Entry point SAIF.Presentation.Web.MVC\clsModelBase.vb

Steps

  1. clsControllerBase.Write() calls Model.Write().
  2. clsModelBase.Write() calls the abstract ValidateData() (BR-MVC-006).
  3. If ValidateData() returns True: call the abstract WriteData() and return its result.
  4. If ValidateData() returns False: return False without calling WriteData().
  5. Both ValidateData() and WriteData() are implemented by the concrete model in the consuming application — no further step tracing is possible from this library alone.

Process flow

flowchart TD
    Start([controller.Write called]) --> ModelWrite[Model.Write]
    ModelWrite --> Validate[ValidateData - concrete model]
    Validate --> Valid{Returns True?}
    Valid -->|Yes| WriteData[WriteData - concrete model]
    Valid -->|No| Fail([Return False, no persistence])
    WriteData --> Success([Return WriteData result])

Failure and edge-case behavior

  • No default validation logic exists in this library; if a consuming model's ValidateData() always returns True, this pipeline provides no actual data-integrity protection on its own.
  • Exceptions thrown by ValidateData() or WriteData() propagate up to ViewPageBase.Page_Error → Error handling.

Sources

  • SAIF.Presentation.Web.MVC\clsModelBase.vb
  • SAIF.Presentation.Web.MVC\clsControllerBase.vb