-
Notifications
You must be signed in to change notification settings - Fork 34
/
Model.cs
64 lines (54 loc) · 1.75 KB
/
Model.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
using System;
namespace OrigoDB.Core
{
/// <summary>
/// Derive your model from this class, mark it serializable.
/// </summary>
[Serializable]
public abstract class Model : MarshalByRefObject
{
/// <summary>
/// Version of the model, incremented by the Engine
/// for each command executed.
/// </summary>
public ulong Revision
{
get;
internal protected set;
}
protected Model(ulong revision)
{
Revision = revision;
}
protected Model(){}
/// <summary>
/// SnapshotRestored is called after the most recent snaphot has been loaded
/// but before any commands are restored.
/// </summary>
protected internal virtual void SnapshotRestored() { }
/// <summary>
/// This method is called after the model has been restored from
/// persistent storage and before the engine is available for transactions.
/// </summary>
protected internal virtual void JournalRestored() { }
[NonSerialized]
private FilteringEventDispatcher _eventDispatcher;
/// <summary>
/// Returns the dispatcher provided by CreateEventDispatcher() on the first call
/// </summary>
protected internal FilteringEventDispatcher EventDispatcher
{
get
{
return _eventDispatcher ?? (_eventDispatcher = CreateEventDispatcher());
}
}
/// <summary>
/// Returns a new FilteringEventDispatcher
/// </summary>
protected virtual FilteringEventDispatcher CreateEventDispatcher()
{
return new FilteringEventDispatcher();
}
}
}