forked from nhibernate/nhibernate-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathChild.cs
123 lines (107 loc) · 2.01 KB
/
Child.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
using System;
using System.Collections;
using System.Collections.Generic;
namespace NHibernate.DomainModel.NHSpecific
{
/// <summary>
/// Summary description for Child.
/// </summary>
public class Child
{
private int _id;
private string _fullName;
private IDictionary<string, Parent> _parents;
private SexType _sex;
private IList<Child> _siblings;
private Child[] _friends;
// default it to today - ms sql has problems with null datetimes
private DateTime _favoriteDate = DateTime.Today;
public Child()
{
_friends = new Child[3];
}
public int Id
{
get { return _id; }
set { _id = value; }
}
public string FullName
{
get { return _fullName; }
set { _fullName = value; }
}
public IList<Child> Siblings
{
get
{
if (_siblings == null) _siblings = new List<Child>();
return _siblings;
}
set { _siblings = value; }
}
public Child FirstSibling
{
get { return (Child) Siblings[0]; }
set { Siblings.Insert(0, value); }
}
public Child SecondSibling
{
get { return (Child) Siblings[1]; }
set { Siblings.Insert(1, value); }
}
public IDictionary<string, Parent> Parents
{
get
{
if (_parents == null) _parents = new Dictionary<string, Parent>();
return _parents;
}
set { _parents = value; }
}
public Parent Mom
{
get { return (Parent) Parents["mom"]; }
set
{
if (Parents.ContainsKey("mom") == false)
{
Parents.Add("mom", value);
}
else
{
Parents["mom"] = value;
}
}
}
public Parent Dad
{
get { return (Parent) Parents["dad"]; }
set
{
if (Parents.ContainsKey("dad") == false)
{
Parents.Add("dad", value);
}
else
{
Parents["dad"] = value;
}
}
}
public SexType Sex
{
get { return _sex; }
set { _sex = value; }
}
public Child[] Friends
{
get { return _friends; }
set { _friends = value; }
}
public DateTime FavoriteDate
{
get { return _favoriteDate; }
set { _favoriteDate = value; }
}
}
}