forked from nhibernate/nhibernate-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDeleteEvent.cs
56 lines (48 loc) · 1.37 KB
/
DeleteEvent.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
using System;
namespace NHibernate.Event
{
/// <summary>Defines an event class for the deletion of an entity. </summary>
[Serializable]
public class DeleteEvent : AbstractEvent
{
private readonly string entityName;
private readonly object entity;
private readonly bool cascadeDeleteEnabled;
/// <summary> Constructs a new DeleteEvent instance. </summary>
/// <param name="entity">The entity to be deleted.</param>
/// <param name="source">The session from which the delete event was generated.
/// </param>
public DeleteEvent(object entity, IEventSource source)
: base(source)
{
if (entity == null)
throw new ArgumentNullException("entity", "Attempt to create delete event with null entity");
this.entity = entity;
}
public DeleteEvent(string entityName, object entity, IEventSource source)
: this(entity, source)
{
this.entityName = entityName;
}
public DeleteEvent(string entityName, object entity, bool isCascadeDeleteEnabled, IEventSource source)
: this(entityName, entity, source)
{
cascadeDeleteEnabled = isCascadeDeleteEnabled;
}
public string EntityName
{
get { return entityName; }
}
/// <summary>
/// Returns the encapsulated entity to be deleted.
/// </summary>
public object Entity
{
get { return entity; }
}
public bool CascadeDeleteEnabled
{
get { return cascadeDeleteEnabled; }
}
}
}