forked from aiska/BpmNet
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProcessInstance.cs
More file actions
64 lines (58 loc) · 2.94 KB
/
Copy pathProcessInstance.cs
File metadata and controls
64 lines (58 loc) · 2.94 KB
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 BPMNET.EntityCore
{
public class ProcessInstance : IAuditTrail
{
public ProcessInstance()
{
ProcessInstanceId = Guid.NewGuid();
SuspensionState = ESuspensionState.ACTIVE;
}
public Guid ProcessInstanceId { get; set; }
public Guid ProcessKey { get; set; }
public string ProcessInstanceName { get; set; }
public string BusinessKey { get; set; }
public ESuspensionState SuspensionState { get; set; }
public string UserCandidates { get; set; }
public string Owner { get; set; }
public DateTime Inserted { get; set; }
public DateTime LastUpdated { get; set; }
public byte[] Timestamp { get; set; }
public override int GetHashCode()
{
unchecked // Overflow is fine, just wrap
{
int hash = ProcessInstanceId.GetHashCode();
// Suitable nullity checks etc, of course :)
if (ProcessKey != null) hash = hash * 17 + ProcessKey.GetHashCode();
if (ProcessInstanceName != null) hash = hash * 17 + ProcessInstanceName.GetHashCode();
if (BusinessKey != null) hash = hash * 17 + BusinessKey.GetHashCode();
hash = hash * 17 + SuspensionState.GetHashCode();
if (UserCandidates != null) hash = hash * 17 + UserCandidates.GetHashCode();
if (Owner != null) hash = hash * 17 + Owner.GetHashCode();
return hash;
}
}
public override bool Equals(object obj)
{
return Equals(obj as ProcessInstance);
}
public bool Equals(ProcessInstance other)
{
// Check for null
if (ReferenceEquals(other, null))
return false;
// Check for same reference
if (ReferenceEquals(this, other))
return true;
// Not Check ProcessInstanceId, because generated Guid
// Check for same value
return ((ProcessKey == null && other.ProcessKey == null) || (ProcessKey != null && other.ProcessKey != null && ProcessKey.Equals(other.ProcessKey))) &&
((ProcessInstanceName == null && other.ProcessInstanceName == null) || (ProcessInstanceName != null && other.ProcessInstanceName != null && ProcessInstanceName.Equals(other.ProcessInstanceName))) &&
((BusinessKey == null && other.BusinessKey == null) || (BusinessKey != null && other.BusinessKey != null && BusinessKey.Equals(other.BusinessKey))) &&
SuspensionState.Equals(other.SuspensionState) &&
((UserCandidates == null && other.UserCandidates == null) || (UserCandidates != null && other.UserCandidates != null && UserCandidates.Equals(other.UserCandidates))) &&
((Owner == null && other.Owner == null) || (Owner != null && other.Owner != null && Owner.Equals(other.Owner)));
}
}
}