forked from nhibernate/nhibernate-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFoo.cs
433 lines (382 loc) · 9.36 KB
/
Foo.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
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
//------------------------------------------------------------------------------
// <autogenerated>
// This code was generated by a tool.
// Runtime Version: v1.1.4322
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </autogenerated>
//------------------------------------------------------------------------------
using System;
using System.Globalization;
using System.Text;
using System.Threading;
using NHibernate.Classic;
using NHibernate.DomainModel.NHSpecific;
namespace NHibernate.DomainModel
{
/// <summary>
/// POJO for Foo
/// </summary>
/// <remark>
/// This class is autogenerated
/// </remark>
[Serializable]
public class Foo : FooProxy, ILifecycle
{
#region Fields
private string _key;
private FooComponent _component;
private long _long;
private int _integer;
private float _float;
private int _x;
// private double _double;
private DateTime _date;
private DateTime _timestamp;
private bool _boolean;
private bool _bool;
private NullableInt32 _null;
private short _short;
private char _char;
private float _zero;
private int _int;
private String _string;
private byte _byte;
private bool _yesno;
private FooStatus _status;
private byte[] _bytes;
private CultureInfo _locale;
// in h2.0.3 this was a float
private int _formula;
private string[] custom;
private int _version;
private FooProxy _foo;
private Fee _dependent;
#endregion
#region Constructors
/// <summary>
/// Default constructor for class Foo
/// </summary>
public Foo()
{
}
public Foo(int x)
{
_x = x;
}
#endregion
#region Properties
/// <summary>
/// Get/set for key
/// </summary>
public string Key
{
get { return _key; }
set { _key = value; }
}
/// <summary>
/// Get/set for long
/// </summary>
public long Long
{
get { return _long; }
set { _long = value; }
}
/// <summary>
/// Get/set for integer
/// </summary>
public int Integer
{
get { return _integer; }
set { _integer = value; }
}
/// <summary>
/// Get/set for float
/// </summary>
public float Float
{
get { return _float; }
set { _float = value; }
}
/// <summary>
/// Get/set for x
/// </summary>
public virtual int X
{
get { return _x; }
set { _x = value; }
}
// /// <summary>
// /// Get/set for double
// /// </summary>
// public double Double
// {
// get { return _double; }
// set { _double = value; }
// }
/// <summary>
/// Get/set for date
/// </summary>
public DateTime Date
{
get { return _date; }
set { _date = value; }
}
/// <summary>
/// Get/set for timestamp
/// </summary>
public DateTime Timestamp
{
get { return _timestamp; }
set { _timestamp = value; }
}
/// <summary>
/// Get/set for boolean
/// </summary>
public bool Boolean
{
get { return _boolean; }
set { _boolean = value; }
}
/// <summary>
/// Get/set for bool
/// </summary>
public bool Bool
{
get { return _bool; }
set { _bool = value; }
}
/// <summary>
/// Get/set for null
/// </summary>
public NullableInt32 Null
{
get { return _null; }
set { _null = value; }
}
/// <summary>
/// Get/set for short
/// </summary>
public short Short
{
get { return _short; }
set { _short = value; }
}
/// <summary>
/// Get/set for char
/// </summary>
public char Char
{
get { return _char; }
set { _char = value; }
}
/// <summary>
/// Get/set for zero
/// </summary>
public float Zero
{
get { return _zero; }
set { _zero = value; }
}
/// <summary>
/// Get/set for int
/// </summary>
public int Int
{
get { return _int; }
set { _int = value; }
}
/// <summary>
/// Get/set for string
/// </summary>
public string String
{
get { return _string; }
set { _string = value; }
}
/// <summary>
/// Get/set for byte
/// </summary>
public byte Byte
{
get { return _byte; }
set { _byte = value; }
}
/// <summary>
/// Get/set for yesno
/// </summary>
public bool YesNo
{
get { return _yesno; }
set { _yesno = value; }
}
/// <summary>
/// Get/set for status
/// </summary>
public FooStatus Status
{
get { return _status; }
set { _status = value; }
}
public byte[] Bytes
{
get { return _bytes; }
set { _bytes = value; }
}
/// <summary>
/// Get/set for locale
/// </summary>
public CultureInfo Locale
{
get { return _locale; }
set { _locale = value; }
}
/// <summary>
/// Get/set for formula
/// </summary>
public int Formula
{
get { return _formula; }
set { _formula = value; }
}
/// <summary>
/// Get/set for custom
/// </summary>
public string[] Custom
{
get { return custom; }
set { custom = value; }
}
/// <summary>
/// Get/set for version
/// </summary>
public int Version
{
get { return _version; }
set { _version = value; }
}
/// <summary>
/// Get/set for foo
/// </summary>
public FooProxy TheFoo
{
get { return _foo; }
set { _foo = value; }
}
/// <summary>
/// Get/set for dependent
/// </summary>
public Fee Dependent
{
get { return _dependent; }
set { _dependent = value; }
}
/// <summary>
/// Gets or sets the component
/// </summary>
public FooComponent Component
{
get { return _component; }
set { _component = value; }
}
public FooComponent NullComponent
{
get { return null; }
set { if (value != null) throw new ArgumentException("Null component"); }
}
#endregion
#region ILifecycle Members
public LifecycleVeto OnUpdate(ISession s)
{
return LifecycleVeto.NoVeto;
}
public void OnLoad(ISession s, object id)
{
}
public LifecycleVeto OnSave(ISession s)
{
_string = "a string";
_date = new DateTime(1970, 01, 01);
_timestamp = DateTime.Now;
_integer = -666;
_long = 696969696969696969L - count++;
_short = 42;
_float = 6666.66f;
//_double = new Double( 1.33e-69 ); // this double is too big for the sap db jdbc driver
//_double = 1.12e-36;
_boolean = true;
_byte = 127;
_int = 2;
_char = '@';
_bytes = Encoding.ASCII.GetBytes(_string);
_status = FooStatus.ON;
custom = new string[]
{
"foo", "bar"
};
//_component = new FooComponent("foo", 12, new DateTime[] { _date, _timestamp, DateTime.MinValue, new DateTime( DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day ) }, new FooComponent("bar", 666, new DateTime[] { new DateTime(1999,12,3), DateTime.MinValue }, null ) );
_component =
new FooComponent("foo", 12,
new DateTime[]
{_date, _timestamp, new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day)},
new FooComponent("bar", 666, new DateTime[] {new DateTime(1999, 12, 3)}, null));
_component.Glarch = new Glarch();
_dependent = new Fee();
_dependent.Fi = "belongs to foo # " + Key;
_locale = Thread.CurrentThread.CurrentCulture;
return LifecycleVeto.NoVeto;
}
public LifecycleVeto OnDelete(ISession s)
{
return LifecycleVeto.NoVeto;
}
#endregion
public void Disconnect()
{
if (_foo != null) _foo.Disconnect();
_foo = null;
}
public bool EqualsFoo(Foo other)
{
if (_bytes != other._bytes)
{
if (_bytes == null || other.Bytes == null) return false;
if (_bytes.Length != other.Bytes.Length) return false;
for (int i = 0; i < _bytes.Length; i++)
{
if (_bytes[i] != other.Bytes[i]) return false;
}
}
return (_bool == other.Bool)
&& ((_boolean == other.Boolean) || (_boolean.Equals(other.Boolean)))
&& ((_byte == other.Byte) || (_byte.Equals(other.Byte)))
//&& ( ( this._date == other._date ) || ( this._date.getDate() == other._date.getDate() && this._date.getMonth() == other._date.getMonth() && this._date.getYear() == other._date.getYear() ) )
// && ( ( _double == other.Double ) || ( _double.Equals(other.Double) ) )
&& ((_float == other.Float) || (_float.Equals(other.Float)))
&& (_int == other.Int)
&& ((_integer == other.Integer) || (_integer.Equals(other.Integer)))
&& ((_long == other.Long) || (_long.Equals(other.Long)))
&& (_null == other.Null)
&& ((_short == other.Short) || (_short.Equals(other.Short)))
&& ((_string == other.String) || (_string.Equals(other.String)))
//&& ( ( this._timestamp==other._timestamp) || ( this._timestamp.getDate() == other._timestamp.getDate() && this._timestamp.getYear() == other._timestamp.getYear() && this._timestamp.getMonth() == other._timestamp.getMonth() ) )
&& (_zero == other.Zero)
&& ((_foo == other.TheFoo) || (_foo.Key.Equals(other.TheFoo.Key)))
// && ( ( _blob == other.Blob ) || ( _blob.Equals(other.Blob) ) )
&& (_yesno == other.YesNo)
&& (_status == other.Status)
// moved binary to its own loop - .net's Collections don't implement Equals() like java's collections.
//&& ( ( _binary == other.Binary ) || _binary.Equals(other.Binary))
&& (_key.Equals(other.Key))
&& (_locale.Equals(other.Locale))
&& ((custom == other.Custom) || (custom[0].Equals(other.Custom[0]) && custom[1].Equals(other.Custom[1])))
;
}
// public override int GetHashCode()
// {
// return key.GetHashCode() - _string.GetHashCode();
// }
private static int count = 0;
}
}