-
Notifications
You must be signed in to change notification settings - Fork 934
/
Copy pathIClassMetadata.cs
149 lines (114 loc) · 4.28 KB
/
IClassMetadata.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
using System.Collections;
using NHibernate.Type;
using NHibernate.Engine;
namespace NHibernate.Metadata
{
/// <summary>
/// Exposes entity class metadata to the application
/// </summary>
/// <seealso cref="NHibernate.ISessionFactory.GetClassMetadata(System.Type)"/>
public interface IClassMetadata
{
/// <summary>
/// The name of the entity
/// </summary>
string EntityName{ get; }
/// <summary>
/// The name of the identifier property (or return null)
/// </summary>
string IdentifierPropertyName { get; }
/// <summary>
/// The names of the class' persistent properties
/// </summary>
string[] PropertyNames { get; }
/// <summary>
/// The identifier Hibernate type
/// </summary>
IType IdentifierType { get; }
/// <summary>
/// The Hibernate types of the classes properties
/// </summary>
IType[] PropertyTypes { get; }
/// <summary>
/// Are instances of this class mutable?
/// </summary>
bool IsMutable { get; }
/// <summary>
/// Are instances of this class versioned by a timestamp or version number column?
/// </summary>
bool IsVersioned { get; }
/// <summary>
/// Gets the index of the version property
/// </summary>
int VersionProperty { get; }
/// <summary>
/// Get the nullability of the class' persistent properties
/// </summary>
bool[] PropertyNullability { get; }
/// <summary> Get the "laziness" of the properties of this class</summary>
bool[] PropertyLaziness { get; }
/// <summary> Which properties hold the natural id?</summary>
int[] NaturalIdentifierProperties { get; }
/// <summary> Does this entity extend a mapped superclass?</summary>
bool IsInherited { get; }
#region stuff that is persister-centric and/or EntityInfo-centric
/// <summary> Get the type of a particular (named) property </summary>
IType GetPropertyType(string propertyName);
/// <summary> Does the class support dynamic proxies? </summary>
bool HasProxy { get; }
/// <summary> Does the class have an identifier property? </summary>
bool HasIdentifierProperty { get; }
/// <summary> Does this entity declare a natural id?</summary>
bool HasNaturalIdentifier { get; }
/// <summary> Does this entity have mapped subclasses?</summary>
bool HasSubclasses { get; }
#endregion
#region stuff that is tuplizer-centric, but is passed a session
/// <summary> Return the values of the mapped properties of the object</summary>
object[] GetPropertyValuesToInsert(object entity, IDictionary mergeMap, ISessionImplementor session);
#endregion
#region stuff that is Tuplizer-centric
/// <summary>
/// The persistent class
/// </summary>
System.Type MappedClass { get; }
/// <summary>
/// Create a class instance initialized with the given identifier
/// </summary>
object Instantiate(object id);
/// <summary>
/// Get the value of a particular (named) property
/// </summary>
object GetPropertyValue(object obj, string propertyName);
/// <summary> Extract the property values from the given entity. </summary>
/// <param name="entity">The entity from which to extract the property values. </param>
/// <returns> The property values. </returns>
object[] GetPropertyValues(object entity);
/// <summary>
/// Set the value of a particular (named) property
/// </summary>
void SetPropertyValue(object obj, string propertyName, object value);
/// <summary>
/// Set the given values to the mapped properties of the given object
/// </summary>
void SetPropertyValues(object entity, object[] values);
/// <summary>
/// Get the identifier of an instance (throw an exception if no identifier property)
/// </summary>
object GetIdentifier(object entity);
/// <summary>
/// Set the identifier of an instance (or do nothing if no identifier property)
/// </summary>
void SetIdentifier(object entity, object id);
/// <summary> Does the class implement the <see cref="Classic.ILifecycle"/> interface?</summary>
bool ImplementsLifecycle { get; }
/// <summary> Does the class implement the <see cref="Classic.IValidatable"/> interface?</summary>
bool ImplementsValidatable { get; }
/// <summary>
/// Get the version number (or timestamp) from the object's version property
/// (or return null if not versioned)
/// </summary>
object GetVersion(object obj);
#endregion
}
}