Files
Saxonite/Workspace/SaxoniteStandardBase/Base/Consoles/SaxSessionDataConsole.cs
T

56 lines
2.1 KiB
C#

using Sarand.Net.Standard.Base.Bus;
using Saxonite.Net.Standard.Base.App;
using Saxonite.Net.Standard.Base.Bus;
using System;
using System.Collections.Generic;
using System.Linq;
namespace Saxonite.Net.Standard.Base.Consoles
{
//=======================================================================
// Some session data is stored to the database but, to avoid potential
// performance issues in action execution, the data to store is cached and
// periodically committed in batches.
//=======================================================================
public abstract class SaxSessionDataConsole : SaxDisposableStateItem
{
//-------------------------------------------------------------------
// Definitions.
//-------------------------------------------------------------------
// Data members.
private SaxInternals internals = null;
//-------------------------------------------------------------------
// Construction.
protected SaxSessionDataConsole(SaxSessionContext sessionContext)
{
SessionContext = sessionContext;
}
protected override void Dispose(bool disposing)
{
if (disposing && internals != null) internals.Dispose(); internals = null;
base.Dispose(disposing);
}
//-------------------------------------------------------------------
// Properties.
protected SaxSessionContext SessionContext { get; }
protected SaxInternals Internals { get { if (internals == null) internals = new SaxInternals(SessionContext); return internals; } }
//-------------------------------------------------------------------
// User activity.
//-------------------------------------------------------------------
// Record latest user active time.
public abstract bool RecordUserActive(SysId userAccountId, DateTime activeAt);
//-------------------------------------------------------------------
// Data commit.
//-------------------------------------------------------------------
public abstract DateTime LastDataCommit();
//-------------------------------------------------------------------
}
//=======================================================================
}