Example #1
0
		public void CustomHQLFunctionsShouldBeRecognizedByTheParser()
		{
			using (ISession s = OpenSession())
			{
				using (ITransaction tx = s.BeginTransaction())
				{
					Country c = new Country() {Id = 100, Name = "US"};
					Person p = new Person() {Age = 35, Name = "My Name", Id=1, Country = c};
					s.Save(c);
					s.Save(p);
					tx.Commit();
				}
			}

			using (ISession s = OpenSession())
			using (ITransaction tx = s.BeginTransaction())
			{
				IList<PersonResult> result = s.CreateQuery("select new PersonResult(p, current_timestamp()) from Person p left join fetch p.Country").List<PersonResult>();

				Assert.AreEqual("My Name", result[0].Person.Name);
				Assert.IsTrue(NHibernateUtil.IsInitialized(result[0].Person.Country));
				tx.Commit();
			}
		}
Example #2
0
		public PersonResult(Person person, DateTime time)
		{
			_person = person;
			_time = time;
		}
Example #3
0
		public PersonResult(Person x)
		{
		}