本文整理汇总了C#中IQuery.SetTimeout方法的典型用法代码示例。如果您正苦于以下问题:C# IQuery.SetTimeout方法的具体用法?C# IQuery.SetTimeout怎么用?C# IQuery.SetTimeout使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IQuery
的用法示例。
在下文中一共展示了IQuery.SetTimeout方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ApplyTransactionTimeout
/// <summary>
/// Applies the current transaction timeout, if any, to the given
/// Hibenrate query object.
/// </summary>
/// <param name="query">The Hibernate Query object.</param>
/// <param name="sessionFactory">Hibernate SessionFactory that the Query was created for
/// (can be <code>null</code>).</param>
/// <exception cref="ArgumentNullException">If query argument is null.</exception>
public static void ApplyTransactionTimeout(IQuery query, ISessionFactory sessionFactory)
{
if (query == null)
{
throw new ArgumentNullException("queryObject", "No query object specified");
}
if (sessionFactory != null)
{
SessionHolder sessionHolder =
(SessionHolder) TransactionSynchronizationManager.GetResource(sessionFactory);
if (sessionHolder != null && sessionHolder.HasTimeout)
{
query.SetTimeout(sessionHolder.TimeToLiveInSeconds);
}
}
}
示例2: OnEvent
public void OnEvent(IQuery query)
{
query.SetTimeout(timeout);
}
示例3: setQueryProperties
protected void setQueryProperties(IQuery query) {
if (maxResults != null) query.SetMaxResults((int)maxResults);
if (firstResult != null) query.SetFirstResult((int)firstResult);
if (cacheable != null) query.SetCacheable((bool)cacheable);
if (cacheRegion != null) query.SetCacheRegion(cacheRegion);
if (comment != null) query.SetComment(comment);
if (flushMode != null) query.SetFlushMode(flushMode);
if (cacheMode != null) query.SetCacheMode(cacheMode);
if (timeout != null) query.SetTimeout((int)timeout);
if (lockMode != null) query.SetLockMode("e", lockMode);
}