DeveelDB  20151217
complete SQL database system, primarly developed for .NET/Mono frameworks
Public Member Functions | Package Functions | Properties | Private Member Functions | Private Attributes | List of all members
Deveel.Data.ActiveSessionList Class Reference

Manages all the open sessions towards a single database within as system. More...

Inheritance diagram for Deveel.Data.ActiveSessionList:

Public Member Functions

 ActiveSessionList (IDatabase database)
 Initializes a new instance of the ActiveSessionList class that is wrapped around a given database context. More...
 
bool IsUserActive (string userName)
 Determines whether the specific user is active. More...
 
IEnumerator< ISessionGetEnumerator ()
 Returns an enumerator that iterates through the collection. More...
 

Package Functions

bool Add (ISession session)
 
void Remove (ISession session)
 

Properties

IDatabase Database [get, private set]
 Gets the database context to which the sessions point to. More...
 
int Count [get]
 Gets the count of the open connections. More...
 
ISession this[int index] [get]
 Gets the ISession at the specified index. More...
 

Private Member Functions

IEnumerator IEnumerable. GetEnumerator ()
 

Private Attributes

readonly List< ISessionsessions
 

Detailed Description

Manages all the open sessions towards a single database within as system.

Definition at line 27 of file ActiveSessionList.cs.

Constructor & Destructor Documentation

Deveel.Data.ActiveSessionList.ActiveSessionList ( IDatabase  database)
inline

Initializes a new instance of the ActiveSessionList class that is wrapped around a given database context.

Parameters
databaseThe database context holding the sessions.
Exceptions
System.ArgumentNullExceptionIf the provided database database context object is null.

Definition at line 37 of file ActiveSessionList.cs.

37  {
38  if (database == null)
39  throw new ArgumentNullException("database");
40 
41  Database = database;
42  sessions = new List<ISession>();
43  }
readonly List< ISession > sessions
IDatabase Database
Gets the database context to which the sessions point to.

Member Function Documentation

bool Deveel.Data.ActiveSessionList.Add ( ISession  session)
inlinepackage

Definition at line 110 of file ActiveSessionList.cs.

110  {
111  lock (this) {
112  if (sessions.Contains(session))
113  return false;
114 
115  sessions.Add(session);
116  return true;
117  }
118  }
readonly List< ISession > sessions
IEnumerator<ISession> Deveel.Data.ActiveSessionList.GetEnumerator ( )
inline

Returns an enumerator that iterates through the collection.

Returns
A T:System.Collections.Generic.IEnumerator`1 that can be used to iterate through the collection.

Definition at line 100 of file ActiveSessionList.cs.

100  {
101  lock (this) {
102  return sessions.GetEnumerator();
103  }
104  }
readonly List< ISession > sessions
IEnumerator IEnumerable. Deveel.Data.ActiveSessionList.GetEnumerator ( )
inlineprivate

Definition at line 106 of file ActiveSessionList.cs.

106  {
107  return GetEnumerator();
108  }
IEnumerator< ISession > GetEnumerator()
Returns an enumerator that iterates through the collection.
bool Deveel.Data.ActiveSessionList.IsUserActive ( string  userName)
inline

Determines whether the specific user is active.

Parameters
userNameName of the user to verify.
Returns

Definition at line 58 of file ActiveSessionList.cs.

58  {
59  lock (this) {
60  return sessions.Any(x => x.User.Name == userName);
61  }
62  }
readonly List< ISession > sessions
void Deveel.Data.ActiveSessionList.Remove ( ISession  session)
inlinepackage

Definition at line 120 of file ActiveSessionList.cs.

120  {
121  lock (this) {
122  sessions.Remove(session);
123  }
124  }
readonly List< ISession > sessions

Member Data Documentation

readonly List<ISession> Deveel.Data.ActiveSessionList.sessions
private

Definition at line 28 of file ActiveSessionList.cs.

Property Documentation

int Deveel.Data.ActiveSessionList.Count
get

Gets the count of the open connections.

The count of open connections.

Definition at line 70 of file ActiveSessionList.cs.

IDatabase Deveel.Data.ActiveSessionList.Database
getprivate set

Gets the database context to which the sessions point to.

The database context.

Definition at line 51 of file ActiveSessionList.cs.

ISession Deveel.Data.ActiveSessionList.this[int index]
get

Gets the ISession at the specified index.

The ISession.

Parameters
indexThe zero-based index of the session to get.
Returns

Definition at line 86 of file ActiveSessionList.cs.


The documentation for this class was generated from the following file: