Пример #1
0
        public void InheritanceSameColumnName()
        {
            using (var session = OpenSession())
                using (var transaction = session.BeginTransaction())
                {
                    var subClass    = new SubClass();
                    var referencing = new ReferencingClass()
                    {
                        SubClass = subClass
                    };
                    session.Save(subClass);
                    session.Save(referencing);

                    transaction.Commit();
                }
            using (var session = OpenSession())
                using (var transaction = session.BeginTransaction())
                {
                    var referencing = session.CreateQuery("from ReferencingClass")
                                      .UniqueResult <ReferencingClass>();

                    // accessing a property of the base class to activate lazy loading
                    // this line crashes because it tries to find the base class by
                    // the wrong column name.
                    BaseClass another;
                    Assert.That(() => another = referencing.SubClass.Another, Throws.Nothing);

                    transaction.Commit();
                }
        }
Пример #2
0
		public void InheritanceSameColumnName()
		{
			using (var session = OpenSession())
			using (var transaction = session.BeginTransaction())
			{
				var subClass = new SubClass();
				var referencing = new ReferencingClass() { SubClass = subClass };
				session.Save(subClass);
				session.Save(referencing);

				transaction.Commit();
			}
			using (var session = OpenSession())
			using (var transaction = session.BeginTransaction())
			{
				var referencing = session.CreateQuery("from ReferencingClass")
					.UniqueResult<ReferencingClass>();

				// accessing a property of the base class to activate lazy loading
				// this line crashes because it tries to find the base class by
				// the wrong column name.
				BaseClass another;
				Assert.That(() => another = referencing.SubClass.Another, Throws.Nothing);

				transaction.Commit();
			}
		}