forked from nhibernate/nhibernate-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFum.cs
163 lines (143 loc) · 2.54 KB
/
Fum.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
using System;
using System.Collections;
namespace NHibernate.DomainModel
{
public class Fum : ILifecycle
{
private String _fum;
private FumCompositeID _id;
private Fum _fo;
private Qux[] _quxArray;
private IDictionary _friends; // <set> mapping
private DateTime _lastUpdated;
public Fum()
{
}
public Fum(FumCompositeID id)
{
_id = id;
_friends = new Hashtable();
//TODO: H2.0.3 - this is diff from H2.0.3 because I am getting a null exception
// when executing the Sql. H203 uses the CalendarType which we don't have so
// I am using DateTime instead...
_lastUpdated = DateTime.Now;
FumCompositeID fid = new FumCompositeID();
fid.Date= new DateTime(2004, 4, 29, 9, 50, 0, 0);
fid.Short= (short) ( id.Short + 33 );
fid.String= id.String + "dd";
Fum f = new Fum();
f.Id = fid;
f.FumString="FRIEND";
//TODO: H2.0.3 - this is diff from H2.0.3 because I am getting a null exception
// when executing the Sql. H203 uses the CalendarType which we don't have so
// I am using DateTime instead...
f.LastUpdated = DateTime.Now;
_friends.Add(f, new object());
}
public string FumString
{
get
{
return _fum;
}
set
{
this._fum = value;
}
}
public FumCompositeID Id
{
get
{
return _id;
}
set
{
this._id = value;
}
}
public Fum Fo
{
get
{
return _fo;
}
set
{
this._fo = value;
}
}
public Qux[] QuxArray
{
get
{
return _quxArray;
}
set
{
this._quxArray = value;
}
}
public IDictionary Friends
{
get
{
return _friends;
}
set
{
this._friends = value;
}
}
public LifecycleVeto OnDelete(ISession s)
{
if (_friends==null) return LifecycleVeto.NoVeto;
try
{
foreach(DictionaryEntry de in _friends)
{
s.Delete(de.Key);
}
}
catch (Exception e)
{
throw new CallbackException(e);
}
return LifecycleVeto.NoVeto;
}
public void OnLoad(ISession s, object id)
{
}
public LifecycleVeto OnSave(ISession s)
{
if (_friends==null) return LifecycleVeto.NoVeto;
try
{
foreach(DictionaryEntry de in _friends)
{
s.Save(de.Key);
}
}
catch (Exception e)
{
throw new CallbackException(e);
}
return LifecycleVeto.NoVeto;
}
public LifecycleVeto OnUpdate(ISession s)
{
return LifecycleVeto.NoVeto;
}
public DateTime LastUpdated
{
get
{
return _lastUpdated;
}
set
{
_lastUpdated = value;
}
}
}
}