DeveelDB  20151217
complete SQL database system, primarly developed for .NET/Mono frameworks
SessionEvent.cs
Go to the documentation of this file.
1 using System;
2 using System.Collections.Generic;
3 
4 namespace Deveel.Data.Diagnostics {
5  public sealed class SessionEvent : Event {
6  public SessionEvent(string userName, int commitId, SessionEventType eventType) {
7  UserName = userName;
8  CommitId = commitId;
9  EventType = eventType;
10  }
11 
12  public string UserName { get; private set; }
13 
14  public int CommitId { get; private set; }
15 
16  public SessionEventType EventType { get; private set; }
17 
18  protected override IEventSource OnSourceSet(IEventSource eventSource) {
19  if (!(eventSource is IDatabase))
20  throw new ArgumentException("Session event sources can be only databases");
21 
22  return base.OnSourceSet(eventSource);
23  }
24 
25  protected override void GetEventData(Dictionary<string, object> data) {
26  data[KnownEventMetadata.UserName] = UserName;
27  data[KnownEventMetadata.CommitId] = CommitId;
28  data["session.eventType"] = EventType.ToString();
29  }
30  }
31 }
The representation of a single database in the system.
Definition: IDatabase.cs:40
SessionEvent(string userName, int commitId, SessionEventType eventType)
Definition: SessionEvent.cs:6
override void GetEventData(Dictionary< string, object > data)
Definition: SessionEvent.cs:25
override IEventSource OnSourceSet(IEventSource eventSource)
Definition: SessionEvent.cs:18
Represents the origin of system events, providing a mechanism to fill the metadata before dispatching...
Definition: IEventSource.cs:40