forked from nhibernate/nhibernate-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStandardProperty.cs
126 lines (113 loc) · 3.27 KB
/
StandardProperty.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
using System;
using NHibernate.Engine;
using NHibernate.Type;
namespace NHibernate.Tuple
{
/// <summary>
/// Represents a basic property within the Hibernate runtime-metamodel.
/// </summary>
/// <remarks>
/// Author: Steve Ebersole
/// </remarks>
public class StandardProperty : Property
{
private readonly bool lazy;
private readonly bool insertable;
private readonly bool updateable;
private readonly bool insertGenerated;
private readonly bool updateGenerated;
private readonly bool nullable;
private readonly bool dirtyCheckable;
private readonly bool versionable;
private readonly CascadeStyle cascadeStyle;
private readonly FetchMode? fetchMode;
/// <summary>
/// Constructs StandardProperty instances.
/// </summary>
/// <param name="name">The name by which the property can be referenced within
/// its owner.</param>
/// <param name="type">The Hibernate Type of this property.</param>
/// <param name="lazy">Should this property be handled lazily?</param>
/// <param name="insertable">Is this property an insertable value?</param>
/// <param name="updateable">Is this property an updateable value?</param>
/// <param name="insertGenerated">Is this property generated in the database on insert?</param>
/// <param name="updateGenerated">Is this property generated in the database on update?</param>
/// <param name="nullable">Is this property a nullable value?</param>
/// <param name="checkable">Is this property a checkable value?</param>
/// <param name="versionable">Is this property a versionable value?</param>
/// <param name="cascadeStyle">The cascade style for this property's value.</param>
/// <param name="fetchMode">Any fetch mode defined for this property </param>
public StandardProperty(
String name,
IType type,
bool lazy,
bool insertable,
bool updateable,
bool insertGenerated,
bool updateGenerated,
bool nullable,
bool checkable,
bool versionable,
CascadeStyle cascadeStyle,
FetchMode? fetchMode)
: base(name, type)
{
this.lazy = lazy;
this.insertable = insertable;
this.updateable = updateable;
this.insertGenerated = insertGenerated;
this.updateGenerated = updateGenerated;
this.nullable = nullable;
this.dirtyCheckable = checkable;
this.versionable = versionable;
this.cascadeStyle = cascadeStyle;
this.fetchMode = fetchMode;
}
public bool IsLazy
{
get { return lazy; }
}
public bool IsInsertable
{
get { return insertable; }
}
public bool IsUpdateable
{
get { return updateable; }
}
public bool IsInsertGenerated
{
get { return insertGenerated; }
}
public bool IsUpdateGenerated
{
get { return updateGenerated; }
}
public bool IsNullable
{
get { return nullable; }
}
// Since 5.3
[Obsolete("This method has no more usage in NHibernate and will be removed in a future version.")]
public bool IsDirtyCheckable(bool hasUninitializedProperties)
{
return IsDirtyCheckable() && (!hasUninitializedProperties || !IsLazy);
}
public bool IsDirtyCheckable()
{
return dirtyCheckable;
}
public bool IsVersionable
{
get { return versionable; }
}
public CascadeStyle CascadeStyle
{
get { return cascadeStyle; }
}
public FetchMode? FetchMode
{
get { return fetchMode; }
}
}
}