-
Notifications
You must be signed in to change notification settings - Fork 113
/
Person.cs
70 lines (60 loc) · 1.74 KB
/
Person.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
using System;
using BLToolkit.Data.Sql.SqlProvider;
using BLToolkit.Mapping;
using BLToolkit.DataAccess;
namespace Data.Linq.Model
{
public class Person
{
public Person()
{
}
public Person(int id)
{
ID = id;
}
public Person(int id, string firstName)
{
ID = id;
FirstName = firstName;
}
[Identity, PrimaryKey]
//[SequenceName("PostgreSQL", "Seq")]
[SequenceName("Firebird", "PersonID")]
[MapField("PersonID")] public int ID;
public string FirstName { get; set; }
public string LastName;
[Nullable] public string MiddleName;
public Gender Gender;
[MapIgnore] public string Name { get { return FirstName + " " + LastName; }}
[Association(ThisKey = "ID", OtherKey = "PersonID", CanBeNull = true)]
public Patient Patient;
public override bool Equals(object obj)
{
return Equals(obj as Person);
}
public bool Equals(Person other)
{
if (ReferenceEquals(null, other)) return false;
if (ReferenceEquals(this, other)) return true;
return
other.ID == ID &&
Equals(other.LastName, LastName) &&
Equals(other.MiddleName, MiddleName) &&
other.Gender == Gender &&
Equals(other.FirstName, FirstName);
}
public override int GetHashCode()
{
unchecked
{
var result = ID;
result = (result * 397) ^ (LastName != null ? LastName.GetHashCode() : 0);
result = (result * 397) ^ (MiddleName != null ? MiddleName.GetHashCode() : 0);
result = (result * 397) ^ Gender.GetHashCode();
result = (result * 397) ^ (FirstName != null ? FirstName.GetHashCode() : 0);
return result;
}
}
}
}