Skip to content

Commit 93d7246

Browse files
Document timeout value unit.
- Fixes #769 ( NH-3922 )
1 parent 2161518 commit 93d7246

15 files changed

+69
-24
lines changed

src/NHibernate/Async/Driver/IResultSetsCommand.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ namespace NHibernate.Driver
1717
using System.Threading;
1818
public partial interface IResultSetsCommand
1919
{
20+
/// <summary>
21+
/// Get a data reader for this multiple result sets command.
22+
/// </summary>
23+
/// <param name="commandTimeout">The timeout in seconds for the underlying ADO.NET query.</param>
24+
/// <param name="cancellationToken">A cancellation token that can be used to cancel the work</param>
25+
/// <returns>A data reader.</returns>
2026
Task<DbDataReader> GetReaderAsync(int? commandTimeout, CancellationToken cancellationToken);
2127
}
22-
}
28+
}

src/NHibernate/Cfg/Environment.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,9 @@ public static string Version
193193

194194
// NHibernate-specific properties
195195
public const string PrepareSql = "prepare_sql";
196+
/// <summary>
197+
/// Set the default timeout in seconds for ADO.NET queries.
198+
/// </summary>
196199
public const string CommandTimeout = "command_timeout";
197200

198201
public const string PropertyBytecodeProvider = "bytecode.provider";

src/NHibernate/Cfg/Loquacious/IDbIntegrationConfigurationProperties.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ public interface IDbIntegrationConfigurationProperties
2929
void TransactionFactory<TFactory>() where TFactory : ITransactionFactory;
3030

3131
bool PrepareCommands { set; }
32+
/// <summary>
33+
/// Set the default timeout in seconds for ADO.NET queries.
34+
/// </summary>
3235
byte Timeout { set; }
3336
void ExceptionConverter<TExceptionConverter>() where TExceptionConverter : ISQLExceptionConverter;
3437
bool AutoCommentSql { set; }
@@ -39,4 +42,4 @@ public interface IDbIntegrationConfigurationProperties
3942

4043
void QueryModelRewriterFactory<TFactory>() where TFactory : IQueryModelRewriterFactory;
4144
}
42-
}
45+
}

src/NHibernate/Cfg/Loquacious/INamedQueryDefinitionBuilder.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ public interface INamedQueryDefinitionBuilder
88
bool IsCacheable { get; set; }
99
string CacheRegion { get; set; }
1010
int FetchSize { get; set; }
11+
/// <summary>
12+
/// The timeout in seconds for the underlying ADO.NET query.
13+
/// </summary>
1114
int Timeout { get; set; }
1215
FlushMode FlushMode { get; set; }
1316
string Query { get; set; }
@@ -76,4 +79,4 @@ public NamedQueryDefinition Build()
7679
return new NamedQueryDefinition(Query, IsCacheable, CacheRegion, Timeout, FetchSize, FlushMode, CacheMode ,IsReadOnly, Comment, new Dictionary<string, string>(1));
7780
}
7881
}
79-
}
82+
}

src/NHibernate/Driver/IResultSetsCommand.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ public partial interface IResultSetsCommand
88
void Append(ISqlCommand command);
99
bool HasQueries { get; }
1010
SqlString Sql { get; }
11+
/// <summary>
12+
/// Get a data reader for this multiple result sets command.
13+
/// </summary>
14+
/// <param name="commandTimeout">The timeout in seconds for the underlying ADO.NET query.</param>
15+
/// <returns>A data reader.</returns>
1116
DbDataReader GetReader(int? commandTimeout);
1217
}
13-
}
18+
}

src/NHibernate/Engine/RowSelection.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ public int MaxRows
4242
}
4343

4444
/// <summary>
45-
/// Gets or Sets the Timeout of the Query
45+
/// The timeout in seconds for the underlying ADO.NET query.
4646
/// </summary>
47-
/// <value>The Query Timeout</value>
48-
/// <remarks>Defaults to NoValue unless specifically set.</remarks>
47+
/// <value>The query timeout in seconds.</value>
48+
/// <remarks>Defaults to <see cref="NoValue" /> unless specifically set.</remarks>
4949
public int Timeout
5050
{
5151
get { return timeout; }
@@ -63,4 +63,4 @@ public bool DefinesLimits
6363
get { return maxRows != NoValue || firstRow > 0; }
6464
}
6565
}
66-
}
66+
}

src/NHibernate/ICriteria.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -246,10 +246,10 @@ public partial interface ICriteria : ICloneable
246246
ICriteria SetFetchSize(int fetchSize);
247247

248248
/// <summary>
249-
/// Set a timeout for the underlying ADO.NET query
249+
/// Set a timeout for the underlying ADO.NET query.
250250
/// </summary>
251-
/// <param name="timeout"></param>
252-
/// <returns></returns>
251+
/// <param name="timeout">The timeout in seconds.</param>
252+
/// <returns><see langword="this" /> (for method chaining).</returns>
253253
ICriteria SetTimeout(int timeout);
254254

255255
/// <summary>

src/NHibernate/IDetachedQuery.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,10 @@ public interface IDetachedQuery
4848
IDetachedQuery SetReadOnly(bool readOnly);
4949

5050
/// <summary>
51-
/// The timeout for the underlying ADO query
51+
/// Set a timeout for the underlying ADO.NET query.
5252
/// </summary>
53-
/// <param name="timeout"></param>
53+
/// <param name="timeout">The timeout in seconds.</param>
54+
/// <returns><see langword="this" /> (for method chaining).</returns>
5455
IDetachedQuery SetTimeout(int timeout);
5556

5657
/// <summary> Set a fetch size for the underlying ADO query.</summary>

src/NHibernate/IMultiCriteria.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,11 @@ public static class MultiCriteriaExtensions
161161
{
162162
//6.0 TODO: Convert to interface method
163163
/// <summary>
164-
/// Set a timeout for the underlying ADO.NET query
164+
/// Set a timeout for the underlying ADO.NET query.
165165
/// </summary>
166+
/// <param name="timeout">The timeout in seconds.</param>
167+
/// <param name="multiCriteria">The <see cref="IMultiCriteria" /> on which to set the timeout.</param>
168+
/// <returns><paramref name="multiCriteria" /> (for method chaining).</returns>
166169
public static IMultiCriteria SetTimeout(this IMultiCriteria multiCriteria, int timeout)
167170
{
168171
if (multiCriteria == null)

src/NHibernate/IMultiQuery.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,9 @@ public partial interface IMultiQuery
144144
IMultiQuery SetForceCacheRefresh(bool forceCacheRefresh);
145145

146146
/// <summary>
147-
/// The timeout for the underlying ADO query
147+
/// Set a timeout for the underlying ADO.NET query.
148148
/// </summary>
149-
/// <param name="timeout"></param>
149+
/// <param name="timeout">The timeout in seconds.</param>
150150
/// <returns>The instance for method chain.</returns>
151151
IMultiQuery SetTimeout(int timeout);
152152

src/NHibernate/IQuery.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,9 +211,10 @@ public partial interface IQuery
211211
IQuery SetCacheRegion(string cacheRegion);
212212

213213
/// <summary>
214-
/// The timeout for the underlying ADO query
214+
/// Set a timeout for the underlying ADO.NET query.
215215
/// </summary>
216-
/// <param name="timeout"></param>
216+
/// <param name="timeout">The timeout in seconds.</param>
217+
/// <returns><see langword="this" /> (for method chaining).</returns>
217218
IQuery SetTimeout(int timeout);
218219

219220
/// <summary> Set a fetch size for the underlying ADO query.</summary>

src/NHibernate/Impl/MultiCriteriaImpl.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -477,8 +477,10 @@ private void ThrowIfKeyAlreadyExists(string key)
477477
}
478478

479479
/// <summary>
480-
/// Set a timeout for the underlying ADO.NET query
480+
/// Set a timeout for the underlying ADO.NET query.
481481
/// </summary>
482+
/// <param name="timeout">The timeout in seconds.</param>
483+
/// <returns><see langword="this" /> (for method chaining).</returns>
482484
public IMultiCriteria SetTimeout(int timeout)
483485
{
484486
_timeout = timeout == RowSelection.NoValue ? (int?) null : timeout;

src/NHibernate/Linq/IQueryableOptions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ public interface IQueryableOptions
3333
IQueryableOptions SetCacheMode(CacheMode cacheMode);
3434

3535
/// <summary>
36-
/// Set the timeout for the underlying ADO query.
36+
/// Set a timeout for the underlying ADO.NET query.
3737
/// </summary>
3838
/// <param name="timeout">The timeout in seconds.</param>
39-
/// <returns><see langword="this"/> (for method chaining).</returns>
39+
/// <returns><see langword="this" /> (for method chaining).</returns>
4040
IQueryableOptions SetTimeout(int timeout);
4141
}
4242
}

src/NHibernate/nhibernate-configuration.xsd

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,13 @@
9999
<xs:enumeration value="sql_exception_converter" />
100100
<xs:enumeration value="adonet.wrap_result_sets" />
101101
<xs:enumeration value="prepare_sql" />
102-
<xs:enumeration value="command_timeout" />
102+
<xs:enumeration value="command_timeout">
103+
<xs:annotation>
104+
<xs:documentation>
105+
Set the default timeout in seconds for ADO.NET queries.
106+
</xs:documentation>
107+
</xs:annotation>
108+
</xs:enumeration>
103109
<xs:enumeration value="adonet.batch_size" />
104110
<xs:enumeration value="use_proxy_validator" />
105111
<xs:enumeration value="xml.output_stylesheet" />

src/NHibernate/nhibernate-mapping.xsd

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1184,7 +1184,13 @@
11841184
</xs:attribute>
11851185
<xs:attribute name="cache-region" type="xs:string" />
11861186
<xs:attribute name="fetch-size" type="xs:int" />
1187-
<xs:attribute name="timeout" type="xs:positiveInteger" />
1187+
<xs:attribute name="timeout" type="xs:positiveInteger">
1188+
<xs:annotation>
1189+
<xs:documentation>
1190+
Set the default timeout in seconds for the underlying ADO.NET query.
1191+
</xs:documentation>
1192+
</xs:annotation>
1193+
</xs:attribute>
11881194
<xs:attribute name="cache-mode" type="cacheMode">
11891195
</xs:attribute>
11901196
<xs:attribute name="read-only" type="xs:boolean">
@@ -1309,7 +1315,13 @@
13091315
</xs:attribute>
13101316
<xs:attribute name="cache-region" type="xs:string" />
13111317
<xs:attribute name="fetch-size" type="xs:int" />
1312-
<xs:attribute name="timeout" type="xs:positiveInteger" />
1318+
<xs:attribute name="timeout" type="xs:positiveInteger">
1319+
<xs:annotation>
1320+
<xs:documentation>
1321+
Set the default timeout in seconds for the underlying ADO.NET query.
1322+
</xs:documentation>
1323+
</xs:annotation>
1324+
</xs:attribute>
13131325
<xs:attribute name="cache-mode" type="cacheMode">
13141326
</xs:attribute>
13151327
<xs:attribute name="read-only" type="xs:boolean">

0 commit comments

Comments
 (0)