Skip to content

Commit

Permalink
By default "Context.SessionStart" starts the configured type of session
Browse files Browse the repository at this point in the history
  • Loading branch information
danieleteti committed Dec 23, 2024
1 parent 048e6f1 commit ca507e8
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions sources/MVCFramework.pas
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,7 @@ TWebContext = class
const AConfig: TMVCConfig; const ASerializers: TDictionary<string, IMVCSerializer>);
destructor Destroy; override;

procedure SessionStart(const SessionType: String); virtual;
procedure SessionStart(SessionType: String = ''); virtual;
procedure SessionStop(const ARaiseExceptionIfExpired: Boolean = True); virtual;

function SessionStarted: Boolean;
Expand Down Expand Up @@ -2431,13 +2431,17 @@ function TWebContext.SessionMustBeClose: Boolean;
Result := FSessionMustBeClose;
end;

procedure TWebContext.SessionStart(const SessionType: String);
procedure TWebContext.SessionStart(SessionType: String);
var
ID: string;
begin
if not Assigned(FWebSession) then
begin
ID := TMVCEngine.SendSessionCookie(Self);
if SessionType.IsEmpty then
begin
SessionType := Config[TMVCConfigKey.SessionType];
end;
FWebSession := AddSessionToTheSessionList(SessionType, ID,
StrToInt64(Config[TMVCConfigKey.SessionTimeout]));
FIsSessionStarted := True;
Expand Down

0 comments on commit ca507e8

Please sign in to comment.