forked from nhibernate/nhibernate-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathContract.cs
119 lines (102 loc) · 2.18 KB
/
Contract.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
using System;
using System.Collections.Generic;
namespace NHibernate.Test.Immutable
{
[Serializable]
public class Contract
{
private long id;
private long version;
private string customerName;
private string type;
private IList<ContractVariation> variations;
private Contract parent;
private ISet<Contract> subcontracts;
private ISet<Plan> plans;
private ISet<Party> parties;
private ISet<Info> infos;
public Contract()
{
}
public Contract(Plan plan, string customerName, string type)
{
plans = new HashSet<Plan>();
if (plan != null)
{
plans.Add(plan);
plan.Contracts.Add(this);
}
this.customerName = customerName;
this.type = type;
variations = new List<ContractVariation>();
subcontracts = new HashSet<Contract>();
parties = new HashSet<Party>();
infos = new HashSet<Info>();
}
public virtual long Id
{
get { return id; }
set { id = value; }
}
public virtual long Version
{
get { return version; }
set { version = value; }
}
public virtual string CustomerName
{
get { return customerName; }
set { customerName = value; }
}
public virtual string Type
{
get { return type; }
set { type = value; }
}
public virtual IList<ContractVariation> Variations
{
get { return variations; }
set { variations = value; }
}
public virtual Contract Parent
{
get { return parent; }
set { parent = value; }
}
public virtual ISet<Contract> Subcontracts
{
get { return subcontracts; }
set { subcontracts = value; }
}
public virtual ISet<Plan> Plans
{
get { return plans; }
set { plans = value; }
}
public virtual ISet<Party> Parties
{
get { return parties; }
set { parties = value; }
}
public virtual ISet<Info> Infos
{
get { return infos; }
set { infos = value; }
}
public virtual void AddSubcontract(Contract subcontract)
{
subcontracts.Add(subcontract);
subcontract.Parent = this;
}
public virtual void AddParty(Party party)
{
parties.Add(party);
party.Contract = this;
}
public virtual void RemoveParty(Party party)
{
parties.Remove(party);
party.Contract = null;
}
}
}