DeveelDB
20151217
complete SQL database system, primarly developed for .NET/Mono frameworks
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
deveeldb.git
src
deveeldb
Deveel.Data.Diagnostics
EventExtensions.cs
Go to the documentation of this file.
1
using
System
;
2
using
System
.Globalization;
3
4
namespace
Deveel
.Data.Diagnostics {
5
public
static
class
EventExtensions
{
6
public
static
T GetData<T>(
this
IEvent
@event,
string
key) {
7
if
(@event == null || @event.EventData == null)
8
return
default
(T);
9
10
object
value;
11
if
(!@event.EventData.TryGetValue(key, out value))
12
return
default
(T);
13
14
if
(value is T)
15
return
(T) value;
16
17
if
(value is IConvertible)
18
return
(T) Convert.ChangeType(value, typeof (T), CultureInfo.InvariantCulture);
19
20
throw
new
InvalidCastException();
21
}
22
23
public
static
string
UserName
(
this
IEvent
@event) {
24
return
@
event
.GetData<
string
>(
KnownEventMetadata
.
UserName
);
25
}
26
27
public
static
string
DatabaseName
(
this
IEvent
@event) {
28
return
@
event
.GetData<
string
>(
KnownEventMetadata
.
DatabaseName
);
29
}
30
31
public
static
int
CommitId
(
this
IEvent
@event) {
32
return
@
event
.GetData<
int
>(
KnownEventMetadata
.
CommitId
);
33
}
34
35
public
static
DateTimeOffset
SessionStartTime
(
this
IEvent
@event) {
36
return
@
event
.GetData<DateTimeOffset>(
KnownEventMetadata
.
SessionStartTime
);
37
}
38
}
39
}
Deveel.Data.Diagnostics.EventExtensions.DatabaseName
static string DatabaseName(this IEvent @event)
Definition:
EventExtensions.cs:27
Deveel.Data.Diagnostics.EventExtensions
Definition:
EventExtensions.cs:5
Deveel
System
Definition:
NonSerializedAttribute.cs:3
Deveel.Data.Diagnostics.IEvent
This is an event occurred during the lifetime of a database.
Definition:
IEvent.cs:24
Deveel.Data.Diagnostics.EventExtensions.CommitId
static int CommitId(this IEvent @event)
Definition:
EventExtensions.cs:31
Deveel.Data.Diagnostics.KnownEventMetadata.DatabaseName
const string DatabaseName
Definition:
KnownEventMetadata.cs:13
Deveel.Data.Diagnostics.EventExtensions.UserName
static string UserName(this IEvent @event)
Definition:
EventExtensions.cs:23
Deveel.Data.Diagnostics.EventExtensions.SessionStartTime
static DateTimeOffset SessionStartTime(this IEvent @event)
Definition:
EventExtensions.cs:35
Deveel.Data.Diagnostics.KnownEventMetadata.CommitId
const string CommitId
Definition:
KnownEventMetadata.cs:8
Deveel.Data.Diagnostics.KnownEventMetadata
Definition:
KnownEventMetadata.cs:4
Deveel.Data.Diagnostics.KnownEventMetadata.UserName
const string UserName
Definition:
KnownEventMetadata.cs:5
Deveel.Data.Diagnostics.KnownEventMetadata.SessionStartTime
const string SessionStartTime
Definition:
KnownEventMetadata.cs:6
Generated by
1.8.10