Skip to content

clsFactoryBase

clsFactoryBase is the abstract factory contract that decouples ViewPageBase/ViewControlBase from the concrete controller and model types a given screen uses. Every screen supplies its own factory implementation; ViewPageBase.Page_Init and ViewControlBase.Page_Init call GetController() on the screen-supplied factory instance to obtain the controller that then drives the rest of the request lifecycle.

Purpose

  • Defines the two-method contract (GetController, GetModel) that lets the framework base classes construct screen-specific controller and model instances without any compile-time reference to those concrete types.
  • Enables clsControllerBase.Model's lazy construction: when no session-stored model exists for the current view, m_factory.GetModel supplies a fresh one.
  • Enables Navigate2's fresh-model creation path: m_factory.GetModel is used to construct the new model instance for a brand-new view GUID.

Context

  • Namespace: SAIF.Presentation.Web.MVC*
  • Assembly/package: SAIF.Presentation.Web.MVC

Public members

Member Signature Purpose
GetController Public MustOverride Function GetController() As clsControllerBase Returns the screen's concrete controller instance; implemented by each screen's own factory subclass
GetModel Public MustOverride Function GetModel() As clsModelBase Returns a new instance of the screen's concrete model type; implemented by each screen's own factory subclass

Behavioral notes

  • Both members are abstract (MustOverride); clsFactoryBase itself performs no construction logic — it exists purely to give ViewPageBase/ViewControlBase/clsControllerBase a common type to hold a reference to.

Constraints and usage notes

  • clsFactoryBase is MustInherit and has no fields, constructor logic, or default implementations — every screen must supply a working factory subclass or the page/control cannot initialize its controller.

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/clsFactoryBase.vb