forked from nhibernate/nhibernate-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFum.cs
157 lines (136 loc) · 3.08 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
using System;
using System.Collections.Generic;
using NHibernate.Classic;
namespace NHibernate.DomainModel
{
[Serializable]
public class MapComponent
{
private IDictionary<string, Fum> _fummap = new Dictionary<string, Fum>();
private IDictionary<string, string> _stringmap = new Dictionary<string, string>();
private int _count;
public IDictionary<string, Fum> Fummap
{
get { return _fummap; }
set { _fummap = value; }
}
public int Count
{
get { return _count; }
set { _count = value; }
}
public IDictionary<string, string> Stringmap
{
get { return _stringmap; }
set { _stringmap = value; }
}
}
public class Fum : ILifecycle
{
private String _fum;
private FumCompositeID _id;
private Fum _fo;
private Qux[] _quxArray;
private ISet<Fum> _friends; // <set> mapping
private DateTime m_LastUpdated;
private MapComponent _mapComponent = new MapComponent();
public Fum()
{
}
public Fum(FumCompositeID id)
{
_id = id;
_friends = new HashSet<Fum>();
//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...
//m_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);
}
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 ISet<Fum> Friends
{
get { return _friends; }
set { this._friends = value; }
}
public LifecycleVeto OnDelete(ISession s)
{
if (_friends == null) return LifecycleVeto.NoVeto;
try
{
foreach (object obj in _friends)
{
s.Delete(obj);
}
}
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 (object obj in _friends)
{
s.Save(obj);
}
}
catch (Exception e)
{
throw new CallbackException(e);
}
return LifecycleVeto.NoVeto;
}
public LifecycleVeto OnUpdate(ISession s)
{
return LifecycleVeto.NoVeto;
}
public DateTime LastUpdated
{
get { return m_LastUpdated; }
set { m_LastUpdated = value; }
}
public MapComponent MapComponent
{
get { return _mapComponent; }
set { _mapComponent = value; }
}
}
}