forked from nhibernate/nhibernate-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathContractVariation.cs
69 lines (60 loc) · 1.3 KB
/
ContractVariation.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
65
66
67
68
69
using System;
using System.Collections.Generic;
namespace NHibernate.Test.Immutable
{
[Serializable]
public class ContractVariation
{
private long version;
private Contract contract;
private string text;
private ISet<Info> infos = new HashSet<Info>();
public ContractVariation()
{
}
public ContractVariation(int version, Contract contract)
{
this.version = version;
this.contract = contract;
this.contract.Variations.Add(this);
}
public virtual long Version
{
get { return version; }
set { version = value; }
}
public virtual Contract Contract
{
get { return contract; }
set { contract = value; }
}
public virtual string Text
{
get { return text; }
set { text = value; }
}
public virtual ISet<Info> Infos
{
get { return infos; }
set { infos = value; }
}
public override int GetHashCode()
{
int hashCode = 0;
unchecked
{
hashCode += 1000000007 * version.GetHashCode();
if (contract != null)
hashCode += 1000000009 * contract.GetHashCode();
}
return hashCode;
}
public override bool Equals(object obj)
{
ContractVariation other = obj as ContractVariation;
if (other == null)
return false;
return (this.version == other.version) && (this.contract.Id == other.contract.Id);
}
}
}