Example #1
0
		protected override void OnSetUp()
		{
			using (ISession sess = OpenSession())
			using (ITransaction tx = sess.BeginTransaction())
			{
				var parent = new Parent {Address = "A street, A town, A country"};

				// If you add a child all work fine.
				//var child = new Child {Age = 2, Parent = parent};
				//parent.Children.AddChild(child);
				
				sess.Save(parent);

				var doctor = new Doctor {DoctorNumber = 123, MedicalRecord = parent.MedicalRecord};

				sess.Save(doctor);
				tx.Commit();

				parentId = parent.Id;
				doctorId = doctor.Id;
			}
		}
Example #2
0
		public virtual bool Equals(Parent other)
		{
			if (ReferenceEquals(null, other)) return false;
			if (ReferenceEquals(this, other)) return true;
			return Equals(other.MedicalRecord, MedicalRecord) && Equals(other.Address, Address) && other.Visits == Visits;
		}