Removed untyped contructor from ComponentRegistration and add a protected setter.
[castle.git] / ActiveRecord / Castle.ActiveRecord / Attributes / HiLoAttribute.cs
blob8bdfa6f0c4903e7fa4b6963b950046a011bdb03a
1 // Copyright 2004-2008 Castle Project - http://www.castleproject.org/
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
15 namespace Castle.ActiveRecord
17 using System;
19 /// <summary>
20 /// Used when a constraint requires a hilo algorithm
21 /// </summary>
22 /// <example><code>
23 /// public class Blog : ActiveRecordBase
24 /// {
25 /// ...
26 ///
27 /// [HasManyAndBelongs/HasMany,
28 /// CollectionID(CollectionIDAttribute.HiLo),
29 /// Hilo]
30 /// public int Id
31 /// {
32 /// get { return _id; }
33 /// set { _id = value; }
34 /// }
35 /// </code></example>
36 [AttributeUsage(AttributeTargets.Property, AllowMultiple=false), Serializable]
37 public class HiloAttribute : Attribute
39 private String _column;
40 private String _table;
41 private int _maxlo;
43 /// <summary>
44 /// Initializes a new instance of the <see cref="HiloAttribute"/> class.
45 /// </summary>
46 public HiloAttribute() : this("hi_value", "next_value", 100)
50 /// <summary>
51 /// Initializes a new instance of the <see cref="HiloAttribute"/> class.
52 /// </summary>
53 /// <param name="table">The table.</param>
54 /// <param name="column">The column.</param>
55 /// <param name="maxlo">The maxlo.</param>
56 public HiloAttribute(string table, String column, int maxlo)
58 _column = column;
59 _table = table;
60 _maxlo = maxlo;
63 /// <summary>
64 /// Gets or sets the column name
65 /// </summary>
66 /// <value>The column.</value>
67 public String Column
69 get { return _column; }
70 set { _column = value; }
73 /// <summary>
74 /// Gets or sets the table name
75 /// </summary>
76 /// <value>The table.</value>
77 public String Table
79 get { return _table; }
80 set { _table = value; }
83 /// <summary>
84 /// Gets or sets the max low value
85 /// </summary>
86 /// <value>The max lo.</value>
87 public int MaxLo
89 get { return _maxlo; }
90 set { _maxlo = value; }