forked from nhibernate/nhibernate-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathQux.cs
197 lines (173 loc) · 3.35 KB
/
Qux.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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
using System;
using System.Collections.Generic;
using NHibernate.Classic;
namespace NHibernate.DomainModel
{
[Serializable]
public class Qux : ILifecycle
{
private ISession _session;
private long _key;
private FooProxy _foo;
private bool _created;
private bool _deleted;
private bool _loaded;
private bool _stored;
private string _stuff;
private ISet<Fum> _fums;
private IList<Fum> _moreFums;
private Qux _child;
private long _childKey;
private Holder _holder;
public Qux()
{
}
public Qux(String s)
{
_stuff = s;
}
#region ILifecycle members
public virtual LifecycleVeto OnSave(ISession session)
{
_created = true;
try
{
Foo = new Foo();
session.Save(Foo);
}
catch (Exception e)
{
throw new CallbackException(e);
}
Foo.String = "child of a qux";
return LifecycleVeto.NoVeto;
}
public virtual LifecycleVeto OnDelete(ISession session)
{
_deleted = true;
try
{
session.Delete(Foo);
}
catch (Exception e)
{
throw new CallbackException(e);
}
//if (child!=null) session.delete(child);
return LifecycleVeto.NoVeto;
}
public virtual void OnLoad(ISession session, object id)
{
_loaded = true;
_session = session;
}
public virtual LifecycleVeto OnUpdate(ISession s)
{
return LifecycleVeto.NoVeto;
}
#endregion
public virtual void Store()
{
}
/// <summary>
/// Gets or sets the _foo
/// </summary>
public virtual FooProxy Foo
{
get { return _foo; }
set { _foo = value; }
}
/// <summary>
/// Gets or sets the _created
/// </summary>
public virtual bool Created
{
get { return _created; }
set { _created = value; }
}
/// <summary>
/// Gets or sets the _deleted
/// </summary>
public virtual bool Deleted
{
get { return _deleted; }
set { _deleted = value; }
}
/// <summary>
/// Gets or sets the _loaded
/// </summary>
public virtual bool Loaded
{
get { return _loaded; }
set { _loaded = value; }
}
/// <summary>
/// Gets or sets the _stored
/// </summary>
public virtual bool Stored
{
get { return _stored; }
set { _stored = value; }
}
/// <summary>
/// Gets or sets the _key
/// </summary>
public virtual long Key
{
get { return _key; }
set { _key = value; }
}
public virtual long TheKey
{
set { _key = value; }
}
/// <summary>
/// Gets or sets the _stuff
/// </summary>
public virtual string Stuff
{
get { return _stuff; }
set { _stuff = value; }
}
/// <summary>
/// Gets or sets the _fums (<set>)
/// </summary>
public virtual ISet<Fum> Fums
{
get { return _fums; }
set { _fums = value; }
}
/// <summary>
/// Gets or sets the _moreFums
/// </summary>
public virtual IList<Fum> MoreFums
{
get { return _moreFums; }
set { _moreFums = value; }
}
public virtual Qux Child
{
get
{
_stored = true;
_childKey = _child == null ? 0 : _child.Key;
if (_childKey != 0 && _child == null) _child = (Qux) _session.Load(typeof(Qux), _childKey);
return _child;
}
set { _child = value; }
}
/// <summary>
/// Gets or sets the _childKey
/// </summary>
public virtual long ChildKey
{
get { return _childKey; }
set { _childKey = value; }
}
public virtual Holder Holder
{
get { return _holder; }
set { _holder = value; }
}
}
}