Permalink
Browse files

Renamed QueryOver.Single() to SingleOrDefault() to closer mimic seman…

…tics of Linq extension methods of the same name.

git-svn-id: https://nhibernate.svn.sourceforge.net/svnroot/nhibernate/trunk@4898 d2eaab8a-a80d-0410-be94-99ecdb4ea5df
  • Loading branch information...
1 parent d83874a commit 46238148b1465e62a0415a3d41a81ff214f9ae67 ricbrown committed Jan 4, 2010
@@ -159,7 +159,7 @@ public void UniqueResult()
{
Person actual =
s.QueryOver<Person>()
- .Single();
+ .SingleOrDefault();
Assert.That(actual.Name, Is.EqualTo("test person 1"));
}
@@ -169,7 +169,7 @@ public void UniqueResult()
string actual =
s.QueryOver<Person>()
.Select(p => p.Name)
- .Single<string>();
+ .SingleOrDefault<string>();
Assert.That(actual, Is.EqualTo("test person 1"));
}
@@ -56,12 +56,12 @@ private IList<U> List<U>()
return criteria.List<U>();
}
- private TRoot Single()
+ private TRoot SingleOrDefault()
{
return criteria.UniqueResult<TRoot>();
}
- private U Single<U>()
+ private U SingleOrDefault<U>()
{
return criteria.UniqueResult<U>();
}
@@ -125,11 +125,11 @@ IList<TRoot> IQueryOver<TRoot>.List()
IList<U> IQueryOver<TRoot>.List<U>()
{ return List<U>(); }
- TRoot IQueryOver<TRoot>.Single()
- { return Single(); }
+ TRoot IQueryOver<TRoot>.SingleOrDefault()
+ { return SingleOrDefault(); }
- U IQueryOver<TRoot>.Single<U>()
- { return Single<U>(); }
+ U IQueryOver<TRoot>.SingleOrDefault<U>()
+ { return SingleOrDefault<U>(); }
IEnumerable<TRoot> IQueryOver<TRoot>.Future()
{ return Future(); }
@@ -49,12 +49,12 @@ public interface IQueryOver<TRoot>
/// <exception cref="HibernateException">
/// If there is more than one matching result
/// </exception>
- TRoot Single();
+ TRoot SingleOrDefault();
/// <summary>
- /// Override type of <see cref="Single()" />.
+ /// Override type of <see cref="SingleOrDefault()" />.
/// </summary>
- U Single<U>();
+ U SingleOrDefault<U>();
/// <summary>
/// Get a enumerable that when enumerated will execute

0 comments on commit 4623814

Please sign in to comment.