forked from nhibernate/nhibernate-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJoinedSubclass.cs
45 lines (39 loc) · 855 Bytes
/
JoinedSubclass.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
using System;
using System.Collections.Generic;
using NHibernate.Engine;
namespace NHibernate.Mapping
{
[Serializable]
public class JoinedSubclass : Subclass, ITableOwner
{
private Table table;
private IKeyValue key;
public JoinedSubclass(PersistentClass superclass)
: base(superclass) { }
public override Table Table
{
get { return table; }
}
Table ITableOwner.Table
{
set
{
table = value;
Superclass.AddSubclassTable(table);
}
}
public override IKeyValue Key
{
get { return key; }
set { key = value; }
}
public override void Validate(IMapping mapping)
{
base.Validate(mapping);
if (Key != null && !Key.IsValid(mapping))
{
throw new MappingException(string.Format("subclass key has wrong number of columns: {0} type: {1}", MappedClass.Name, Key.Type.Name));
}
}
}
}