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; } }
public virtual bool Equals(Doctor other) { if (ReferenceEquals(null, other)) return false; if (ReferenceEquals(this, other)) return true; return other.doctorNumber == doctorNumber; }