unit ApplicationContext; // Dit is een klasse bedoeld om data te delen over de applicatie heen. // Dit kan bijvoorbeeld usernaam, login token, computernaam, ... // Informatie die elk component/klasse kan gebruiken. // Voor schaalbaarheid en isolatie worden interfaces gebruikt die deze klasse implementeert. interface uses ObserverPattern; // SUB CONTEXTS: klassen die overeenkomen met bepaalde sub-context (bv. alles gerelateerd met authenticatie). // - UserServerService type TUserServerServiceContext = class(TSubject) private FSessionKey: string; FGebruikersNaam: string; FIsOK: Boolean; FErrorMessage: string; FInternalErrorMessage: string; public procedure Changed(); property SessionKey: string read FSessionKey write FSessionKey; property GebruikersNaam: string read FGebruikersNaam write FGebruikersNaam; property IsOK: Boolean read FIsOK write FIsOK; property ErrorMessage: string read FErrorMessage write FErrorMessage; property InternalErrorMessage: string read FInternalErrorMessage write FInternalErrorMessage; end; // APPLICATION CONTEXT // Application context bevat alle sub-contexts TApplicationContext = class private FUserServerServiceContext: TUserServerServiceContext; public constructor Create(); property UserServerServiceContext: TUserServerServiceContext read FUserServerServiceContext write FUserServerServiceContext; end; implementation procedure TUserServerServiceContext.Changed(); begin self.Change(); end; constructor TApplicationContext.Create(); begin FUserServerServiceContext := TUserServerServiceContext.Create(); end; end.