-
Notifications
You must be signed in to change notification settings - Fork 934
/
Copy pathNonUniqueResultException.cs
41 lines (39 loc) · 1.45 KB
/
NonUniqueResultException.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
using System;
using System.Runtime.Serialization;
using log4net;
namespace NHibernate
{
/// <summary>
/// Thrown when the application calls <see cref="IQuery.UniqueResult()">IQuery.UniqueResult()</see>
/// and the query returned more than one result. Unlike all other NHibernate
/// exceptions, this one is recoverable!
/// </summary>
[Serializable]
public class NonUniqueResultException : HibernateException
{
/// <summary>
/// Initializes a new instance of the <see cref="NonUniqueResultException"/> class.
/// </summary>
/// <param name="resultCount">The number of items in the result.</param>
public NonUniqueResultException( int resultCount )
: base( "query did not return a unique result: " + resultCount.ToString() )
{
LogManager.GetLogger( typeof( NonUniqueResultException ) ).Error( "query did not return a unique result: " + resultCount.ToString() );
}
/// <summary>
/// Initializes a new instance of the <see cref="NonUniqueResultException"/> class
/// with serialized data.
/// </summary>
/// <param name="info">
/// The <see cref="SerializationInfo"/> that holds the serialized object
/// data about the exception being thrown.
/// </param>
/// <param name="context">
/// The <see cref="StreamingContext"/> that contains contextual information about the source or destination.
/// </param>
protected NonUniqueResultException( SerializationInfo info, StreamingContext context )
: base( info, context )
{
}
}
}