comparison UnitTests/Linq/Model/Patient.cs @ 0:f990fcb411a9

Копия текущей версии из github
author cin
date Thu, 27 Mar 2014 21:46:09 +0400
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:f990fcb411a9
1 using System;
2
3 using BLToolkit.DataAccess;
4 using BLToolkit.Mapping;
5
6 namespace Data.Linq.Model
7 {
8 public class Patient
9 {
10 [PrimaryKey]
11 public int PersonID;
12 public string Diagnosis;
13
14 [Association(ThisKey = "PersonID", OtherKey = "ID", CanBeNull = false)]
15 public Person Person;
16
17 public override bool Equals(object obj)
18 {
19 return Equals(obj as Patient);
20 }
21
22 public bool Equals(Patient other)
23 {
24 if (ReferenceEquals(null, other)) return false;
25 if (ReferenceEquals(this, other)) return true;
26 return other.PersonID == PersonID && Equals(other.Diagnosis, Diagnosis);
27 }
28
29 public override int GetHashCode()
30 {
31 unchecked
32 {
33 var result = PersonID;
34 result = (result * 397) ^ (Diagnosis != null ? Diagnosis.GetHashCode() : 0);
35 return result;
36 }
37 }
38 }
39 }