Class BaseSession
Implements base ISession functionality
Inherited Members
Namespace: NFX.ApplicationModel
Assembly: NFX.dll
Syntax
[Serializable]
public class BaseSession : ISession, IEndableInstance
Constructors
BaseSession()
Declaration
protected BaseSession()
BaseSession(Guid)
Declaration
public BaseSession(Guid id)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | id |
Properties
ID
Returns Session ID
Declaration
public Guid ID { get; }
Property Value
Type | Description |
---|---|
System.Guid |
IDSecret
Returns Session ID secret - the ulong that identifies this session. This property is needed for cross-check upon GUID id lookup, so that Session ID GUID can not be forged by the client - a form of a "password"
Declaration
public ulong IDSecret { get; }
Property Value
Type | Description |
---|---|
System.UInt64 |
IsEnded
Indicates whether this session was ended and will be destroyed after current request processing cycle
Declaration
public bool IsEnded { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsJustLoggedIn
Indicates that user login happened in current request processing cycle. This flag is useful for long term token assignment on release
Declaration
public bool IsJustLoggedIn { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsNew
Indicates that session object was just created with current request processing cycle
Declaration
public bool IsNew { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Item[Object]
Shortcut to .Items. Getter return null instead of throwing if key is not found
Declaration
public object this[object key] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
System.Object | key |
Property Value
Type | Description |
---|---|
System.Object |
Items
Provides a thread-safe dictionary of items
Declaration
public IDictionary<object, object> Items { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IDictionary<System.Object, System.Object> |
LanguageISOCode
Returns user language preference or null
Declaration
public virtual string LanguageISOCode { get; }
Property Value
Type | Description |
---|---|
System.String |
LastLoginType
Returns the last login type
Declaration
public SessionLoginType LastLoginType { get; }
Property Value
Type | Description |
---|---|
SessionLoginType |
LastLoginUTC
Returns the UTC DateTime of the last login/when HasJustLoggedIn() was called for the last time within the lifetime of this session object or NULL
Declaration
public DateTime? LastLoginUTC { get; }
Property Value
Type | Description |
---|---|
System.Nullable<System.DateTime> |
OldID
When this parameter is not null then RegenerateID() was called and session provider may need to re-stow session object under a new ID
Declaration
public Guid? OldID { get; }
Property Value
Type | Description |
---|---|
System.Nullable<System.Guid> |
User
Returns session user
Declaration
public User User { get; set; }
Property Value
Type | Description |
---|---|
User |
Methods
Acquire()
Declaration
public virtual void Acquire()
End()
Ends session
Declaration
public virtual void End()
HasJustLoggedIn(SessionLoginType)
Called from business code when user supplies login credentals and/or performs another action that can be qualified as a reliable user identity proof
Declaration
public virtual void HasJustLoggedIn(SessionLoginType loginType)
Parameters
Type | Name | Description |
---|---|---|
SessionLoginType | loginType |
RegenerateID()
Generates new GUID and stores it in ID storing old ID value in OldID property which is not serializable. The implementations may elect to re-stow the existing session under the new ID. This method is usefull for security, i.e. when user logs-in we may want to re-generate ID
Declaration
public void RegenerateID()
Release()
Declaration
public virtual void Release()