Skip to content

Commit 5a9aff6

Browse files
rjpereshazzik
authored andcommitted
NH-3404
1 parent 71994bd commit 5a9aff6

File tree

1 file changed

+317
-0
lines changed

1 file changed

+317
-0
lines changed

src/NHibernate/Mapping/ByCode/Generators.cs

Lines changed: 317 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,16 @@ static Generators()
1717
Assigned = new AssignedGeneratorDef();
1818
EnhancedSequence = new EnhancedSequenceGeneratorDef();
1919
EnhancedTable = new EnhancedTableGeneratorDef();
20+
Counter = new CounterGeneratorDef();
21+
Increment = new IncrementGeneratorDef();
22+
NativeGuid = new NativeGuidGeneratorDef();
23+
Select = new SelectGeneratorDef();
24+
SequenceHiLo = new SequenceHiLoGeneratorDef();
25+
SequenceIdentity = new SequenceIdentityGeneratorDef();
26+
Table = new TableGeneratorDef();
27+
TriggerIdentity = new TriggerIdentityGeneratorDef();
28+
UUIDHex = new UUIDHexGeneratorDef();
29+
UUIDString = new UUIDStringGeneratorDef();
2030
}
2131

2232
public static IGeneratorDef Assigned { get; private set; }
@@ -28,6 +38,16 @@ static Generators()
2838
public static IGeneratorDef Identity { get; private set; }
2939
public static IGeneratorDef EnhancedSequence { get; private set; }
3040
public static IGeneratorDef EnhancedTable { get; private set; }
41+
public static IGeneratorDef Counter { get; private set; }
42+
public static IGeneratorDef Increment { get; private set; }
43+
public static IGeneratorDef NativeGuid { get; private set; }
44+
public static IGeneratorDef Select { get; private set; }
45+
public static IGeneratorDef SequenceHiLo { get; private set; }
46+
public static IGeneratorDef Table { get; private set; }
47+
public static IGeneratorDef TriggerIdentity { get; private set; }
48+
public static IGeneratorDef SequenceIdentity { get; private set; }
49+
public static IGeneratorDef UUIDHex { get; private set; }
50+
public static IGeneratorDef UUIDString { get; private set; }
3151

3252
public static IGeneratorDef Foreign<TEntity>(Expression<Func<TEntity, object>> property)
3353
{
@@ -40,6 +60,303 @@ public static IGeneratorDef Foreign(MemberInfo property)
4060
}
4161
}
4262

63+
public class UUIDStringGeneratorDef : IGeneratorDef
64+
{
65+
#region Implementation of IGeneratorDef
66+
67+
public string Class
68+
{
69+
get { return "uuid.string"; }
70+
}
71+
72+
public object Params
73+
{
74+
get { return null; }
75+
}
76+
77+
public System.Type DefaultReturnType
78+
{
79+
get { return typeof(string); }
80+
}
81+
82+
public bool SupportedAsCollectionElementId
83+
{
84+
get { return false; }
85+
}
86+
87+
#endregion
88+
}
89+
90+
public class UUIDHexGeneratorDef : IGeneratorDef
91+
{
92+
#region Implementation of IGeneratorDef
93+
94+
public string Class
95+
{
96+
get { return "uuid.hex"; }
97+
}
98+
99+
public object Params
100+
{
101+
get { return null; }
102+
}
103+
104+
public System.Type DefaultReturnType
105+
{
106+
get { return typeof(Guid); }
107+
}
108+
109+
public bool SupportedAsCollectionElementId
110+
{
111+
get { return false; }
112+
}
113+
114+
#endregion
115+
}
116+
117+
public class TriggerIdentityGeneratorDef : IGeneratorDef
118+
{
119+
#region Implementation of IGeneratorDef
120+
121+
public string Class
122+
{
123+
get { return "trigger-identity"; }
124+
}
125+
126+
public object Params
127+
{
128+
get { return null; }
129+
}
130+
131+
public System.Type DefaultReturnType
132+
{
133+
get { return typeof(int); }
134+
}
135+
136+
public bool SupportedAsCollectionElementId
137+
{
138+
get { return false; }
139+
}
140+
141+
#endregion
142+
}
143+
144+
public class TableHiLoGeneratorDef : IGeneratorDef
145+
{
146+
#region Implementation of IGeneratorDef
147+
148+
public string Class
149+
{
150+
get { return "table-hilo"; }
151+
}
152+
153+
public object Params
154+
{
155+
get { return null; }
156+
}
157+
158+
public System.Type DefaultReturnType
159+
{
160+
get { return typeof(int); }
161+
}
162+
163+
public bool SupportedAsCollectionElementId
164+
{
165+
get { return false; }
166+
}
167+
168+
#endregion
169+
}
170+
171+
public class TableGeneratorDef : IGeneratorDef
172+
{
173+
#region Implementation of IGeneratorDef
174+
175+
public string Class
176+
{
177+
get { return "table"; }
178+
}
179+
180+
public object Params
181+
{
182+
get { return null; }
183+
}
184+
185+
public System.Type DefaultReturnType
186+
{
187+
get { return typeof(int); }
188+
}
189+
190+
public bool SupportedAsCollectionElementId
191+
{
192+
get { return false; }
193+
}
194+
195+
#endregion
196+
}
197+
198+
public class SequenceIdentityGeneratorDef : IGeneratorDef
199+
{
200+
#region Implementation of IGeneratorDef
201+
202+
public string Class
203+
{
204+
get { return "sequence-identity"; }
205+
}
206+
207+
public object Params
208+
{
209+
get { return null; }
210+
}
211+
212+
public System.Type DefaultReturnType
213+
{
214+
get { return typeof(int); }
215+
}
216+
217+
public bool SupportedAsCollectionElementId
218+
{
219+
get { return false; }
220+
}
221+
222+
#endregion
223+
}
224+
225+
public class SequenceHiLoGeneratorDef : IGeneratorDef
226+
{
227+
#region Implementation of IGeneratorDef
228+
229+
public string Class
230+
{
231+
get { return "seqhilo"; }
232+
}
233+
234+
public object Params
235+
{
236+
get { return null; }
237+
}
238+
239+
public System.Type DefaultReturnType
240+
{
241+
get { return typeof(int); }
242+
}
243+
244+
public bool SupportedAsCollectionElementId
245+
{
246+
get { return false; }
247+
}
248+
249+
#endregion
250+
}
251+
252+
public class SelectGeneratorDef : IGeneratorDef
253+
{
254+
#region Implementation of IGeneratorDef
255+
256+
public string Class
257+
{
258+
get { return "select"; }
259+
}
260+
261+
public object Params
262+
{
263+
get { return null; }
264+
}
265+
266+
public System.Type DefaultReturnType
267+
{
268+
get { return null; }
269+
}
270+
271+
public bool SupportedAsCollectionElementId
272+
{
273+
get { return false; }
274+
}
275+
276+
#endregion
277+
}
278+
279+
public class NativeGuidGeneratorDef : IGeneratorDef
280+
{
281+
#region Implementation of IGeneratorDef
282+
283+
public string Class
284+
{
285+
get { return "guid.native"; }
286+
}
287+
288+
public object Params
289+
{
290+
get { return null; }
291+
}
292+
293+
public System.Type DefaultReturnType
294+
{
295+
get { return typeof(Guid); }
296+
}
297+
298+
public bool SupportedAsCollectionElementId
299+
{
300+
get { return true; }
301+
}
302+
303+
#endregion
304+
}
305+
306+
public class IncrementGeneratorDef : IGeneratorDef
307+
{
308+
#region Implementation of IGeneratorDef
309+
310+
public string Class
311+
{
312+
get { return "increment"; }
313+
}
314+
315+
public object Params
316+
{
317+
get { return null; }
318+
}
319+
320+
public System.Type DefaultReturnType
321+
{
322+
get { return typeof(long); }
323+
}
324+
325+
public bool SupportedAsCollectionElementId
326+
{
327+
get { return false; }
328+
}
329+
330+
#endregion
331+
}
332+
333+
public class CounterGeneratorDef : IGeneratorDef
334+
{
335+
#region Implementation of IGeneratorDef
336+
337+
public string Class
338+
{
339+
get { return "counter"; }
340+
}
341+
342+
public object Params
343+
{
344+
get { return null; }
345+
}
346+
347+
public System.Type DefaultReturnType
348+
{
349+
get { return typeof(short); }
350+
}
351+
352+
public bool SupportedAsCollectionElementId
353+
{
354+
get { return false; }
355+
}
356+
357+
#endregion
358+
}
359+
43360
public class AssignedGeneratorDef : IGeneratorDef
44361
{
45362
#region Implementation of IGeneratorDef

0 commit comments

Comments
 (0)