There is a small problem here, Single will throw if there isn't a value, UniqueResult will return null. It probably should be SingleOrDefault
---------- Forwarded message ---------- From: <[email protected]> Date: Mon, Jan 4, 2010 at 5:21 PM Subject: [Nhibernate-commit] SF.net SVN: nhibernate:[4897] trunk/nhibernate/src/NHibernate To: [email protected] Revision: 4897 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4897&view=rev Author: ricbrown Date: 2010-01-04 15:20:56 +0000 (Mon, 04 Jan 2010) Log Message: ----------- Renamed QueryOver UniqueResult() to Single(). Modified Paths: -------------- trunk/nhibernate/src/NHibernate/Criterion/QueryOver.cs trunk/nhibernate/src/NHibernate/IQueryOver.cs trunk/nhibernate/src/NHibernate.Test/Criteria/Lambda/IntegrationFixture.cs Modified: trunk/nhibernate/src/NHibernate/Criterion/QueryOver.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Criterion/QueryOver.cs 2009-12-16 21:52:08 UTC (rev 4896) +++ trunk/nhibernate/src/NHibernate/Criterion/QueryOver.cs 2010-01-04 15:20:56 UTC (rev 4897) @@ -56,12 +56,12 @@ return criteria.List<U>(); } - private TRoot UniqueResult() + private TRoot Single() { return criteria.UniqueResult<TRoot>(); } - private U UniqueResult<U>() + private U Single<U>() { return criteria.UniqueResult<U>(); } @@ -125,11 +125,11 @@ IList<U> IQueryOver<TRoot>.List<U>() { return List<U>(); } - TRoot IQueryOver<TRoot>.UniqueResult() - { return UniqueResult(); } + TRoot IQueryOver<TRoot>.Single() + { return Single(); } - U IQueryOver<TRoot>.UniqueResult<U>() - { return UniqueResult<U>(); } + U IQueryOver<TRoot>.Single<U>() + { return Single<U>(); } IEnumerable<TRoot> IQueryOver<TRoot>.Future() { return Future(); } Modified: trunk/nhibernate/src/NHibernate/IQueryOver.cs =================================================================== --- trunk/nhibernate/src/NHibernate/IQueryOver.cs 2009-12-16 21:52:08 UTC (rev 4896) +++ trunk/nhibernate/src/NHibernate/IQueryOver.cs 2010-01-04 15:20:56 UTC (rev 4897) @@ -49,12 +49,12 @@ /// <exception cref="HibernateException"> /// If there is more than one matching result /// </exception> - TRoot UniqueResult(); + TRoot Single(); /// <summary> - /// Override type of <see cref="UniqueResult()" />. + /// Override type of <see cref="Single()" />. /// </summary> - U UniqueResult<U>(); + U Single<U>(); /// <summary> /// Get a enumerable that when enumerated will execute Modified: trunk/nhibernate/src/NHibernate.Test/Criteria/Lambda/IntegrationFixture.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/Criteria/Lambda/IntegrationFixture.cs 2009-12-16 21:52:08 UTC (rev 4896) +++ trunk/nhibernate/src/NHibernate.Test/Criteria/Lambda/IntegrationFixture.cs 2010-01-04 15:20:56 UTC (rev 4897) @@ -159,7 +159,7 @@ { Person actual = s.QueryOver<Person>() - .UniqueResult(); + .Single(); Assert.That(actual.Name, Is.EqualTo("test person 1")); } @@ -169,7 +169,7 @@ string actual = s.QueryOver<Person>() .Select(p => p.Name) - .UniqueResult<string>(); + .Single<string>(); Assert.That(actual, Is.EqualTo("test person 1")); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support A streamlined, 14 day to market process makes app distribution fast and easy Join now and get one step closer to millions of Verizon customers http://p.sf.net/sfu/verizon-dev2dev _______________________________________________ Nhibernate-commit mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/nhibernate-commit
