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

Копия текущей версии из github
author cin
date Thu, 27 Mar 2014 21:46:09 +0400
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/UnitTests/Linq/Model/Patient.cs	Thu Mar 27 21:46:09 2014 +0400
@@ -0,0 +1,39 @@
+using System;
+
+using BLToolkit.DataAccess;
+using BLToolkit.Mapping;
+
+namespace Data.Linq.Model
+{
+	public class Patient
+	{
+		[PrimaryKey]
+		public int    PersonID;
+		public string Diagnosis;
+
+		[Association(ThisKey = "PersonID", OtherKey = "ID", CanBeNull = false)]
+		public Person Person;
+
+		public override bool Equals(object obj)
+		{
+			return Equals(obj as Patient);
+		}
+
+		public bool Equals(Patient other)
+		{
+			if (ReferenceEquals(null, other)) return false;
+			if (ReferenceEquals(this, other)) return true;
+			return other.PersonID == PersonID && Equals(other.Diagnosis,  Diagnosis);
+		}
+
+		public override int GetHashCode()
+		{
+			unchecked
+			{
+				var result = PersonID;
+				result = (result * 397) ^ (Diagnosis != null ? Diagnosis.GetHashCode() : 0);
+				return result;
+			}
+		}
+	}
+}