forked from nhibernate/nhibernate-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHbmDiscriminator.cs
62 lines (56 loc) · 1 KB
/
HbmDiscriminator.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
using System.Collections.Generic;
using System.Xml.Serialization;
namespace NHibernate.Cfg.MappingSchema
{
public partial class HbmDiscriminator: IColumnsMapping, IFormulasMapping
{
#region Implementation of IColumnsMapping
[XmlIgnore]
public IEnumerable<HbmColumn> Columns
{
get
{
if(Item as HbmColumn != null)
{
yield return (HbmColumn)Item;
}
else if (string.IsNullOrEmpty(column))
{
yield break;
}
else
{
yield return new HbmColumn
{
name = column,
length = length,
notnull = notnull,
notnullSpecified = true
};
}
}
}
#endregion
#region Implementation of IFormulasMapping
[XmlIgnore]
public IEnumerable<HbmFormula> Formulas
{
get
{
if (Item as HbmFormula != null)
{
yield return (HbmFormula) Item;
}
else if (string.IsNullOrEmpty(formula))
{
yield break;
}
else
{
yield return new HbmFormula {Text = new[] {formula}};
}
}
}
#endregion
}
}