/// <summary> /// Sets the timeout in seconds for the underlying ADO.NET query. /// </summary> /// <param name="batch">The batch.</param> /// <param name="timeout">The timeout for the batch.</param> /// <returns>The batch instance for method chain.</returns> public static IQueryBatch SetTimeout(this IQueryBatch batch, int?timeout) { if (batch == null) { throw new ArgumentNullException(nameof(batch)); } batch.Timeout = timeout == RowSelection.NoValue ? null : timeout; return(batch); }
/// <summary> /// Overrides the current session flush mode, just for this query batch. /// </summary> /// <param name="batch">The batch.</param> /// <param name="mode">The flush mode for the batch.</param> /// <returns>The batch instance for method chain.</returns> public static IQueryBatch SetFlushMode(this IQueryBatch batch, FlushMode mode) { if (batch == null) { throw new ArgumentNullException(nameof(batch)); } batch.FlushMode = mode; return(batch); }
/// <summary> /// Adds a query to the batch. /// </summary> /// <param name="batch">The batch.</param> /// <param name="key">A key for retrieval of the query result.</param> /// <param name="query">The query.</param> /// <param name="selector">An aggregation function to apply to <paramref name="query"/>.</param> /// <typeparam name="TSource">The type of the query elements before aggregation.</typeparam> /// <typeparam name="TResult">The type resulting of the query result aggregation.</typeparam> /// <exception cref="InvalidOperationException">Thrown if the batch has already been executed.</exception> /// <exception cref="ArgumentNullException">Thrown if <paramref name="query"/> is <see langword="null"/>.</exception> /// <returns>The batch instance for method chain.</returns> public static IQueryBatch Add <TSource, TResult>(this IQueryBatch batch, string key, IQueryable <TSource> query, Expression <Func <IQueryable <TSource>, TResult> > selector) { if (batch == null) { throw new ArgumentNullException(nameof(batch)); } batch.Add(key, For(query, selector)); return(batch); }
/// <summary> /// Adds a query to the batch. /// </summary> /// <param name="batch">The batch.</param> /// <param name="key">A key for retrieval of the query result.</param> /// <param name="query">The query.</param> /// <typeparam name="TResult">The type of the query result elements.</typeparam> /// <exception cref="InvalidOperationException">Thrown if the batch has already been executed.</exception> /// <exception cref="ArgumentNullException">Thrown if <paramref name="query"/> is <see langword="null"/>.</exception> /// <returns>The batch instance for method chain.</returns> public static IQueryBatch Add <TResult>(this IQueryBatch batch, string key, IQueryOver <TResult> query) { if (batch == null) { throw new ArgumentNullException(nameof(batch)); } batch.Add(key, For <TResult>(query)); return(batch); }
/// <inheritdoc /> public override void EstablishFor(IShard shard, IQueryBatch queryBatch, string key = null) { if (key != null) { queryBatch.Add <T>(key, this.shardedCriteria.EstablishFor(shard)); } else { queryBatch.Add <T>(this.shardedCriteria.EstablishFor(shard)); } }
private static IQueryBatch Add <TResult>(this IQueryBatch batch, IQueryBatchItem <TResult> query, Action <IList <TResult> > afterLoad) { if (batch == null) { throw new ArgumentNullException(nameof(batch)); } if (query == null) { throw new ArgumentNullException(nameof(query)); } if (afterLoad != null) { query.AfterLoadCallback += afterLoad; } batch.Add(query); return(batch); }
public FutureEnumerable(IQueryBatch batch, IQueryBatchItem <TResult> query) { _result = new FutureList <TResult>(batch, query); }
public FutureList(IQueryBatch batch, IQueryBatchItem <TResult> query) { _batch = batch; _query = query; }
public FutureValue(IQueryBatch batch, IQueryBatchItem <TResult> query) { _futureList = new FutureList <TResult>(batch, query); }
/// <summary> /// Adds a query to the batch, returning it as an <see cref="IFutureValue{T}"/>. /// </summary> /// <param name="batch">The batch.</param> /// <param name="query">The query.</param> /// <typeparam name="TResult">The type of the query result elements.</typeparam> /// <returns>A future query which execution will be handled by the batch.</returns> public static IFutureValue <TResult> AddAsFutureValue <TResult>(this IQueryBatch batch, IQueryBatchItem <TResult> query) { batch.Add(query); return(new FutureValue <TResult>(batch, query)); }
/// <summary> /// Adds a query to the batch, returning it as an <see cref="IFutureValue{T}"/>. /// </summary> /// <param name="batch">The batch.</param> /// <param name="query">The query.</param> /// <typeparam name="TResult">The type of the query result elements.</typeparam> /// <returns>A future query which execution will be handled by the batch.</returns> public static IFutureValue <TResult> AddAsFutureValue <TResult>(this IQueryBatch batch, IQuery query) { return(AddAsFutureValue(batch, For <TResult>(query))); }
/// <summary> /// Adds a query to the batch, returning it as an <see cref="IFutureValue{T}"/>. /// </summary> /// <param name="batch">The batch.</param> /// <param name="query">The query.</param> /// <param name="selector">An aggregation function to apply to <paramref name="query"/>.</param> /// <typeparam name="TSource">The type of the query elements before aggregation.</typeparam> /// <typeparam name="TResult">The type resulting of the query result aggregation.</typeparam> /// <returns>A future query which execution will be handled by the batch.</returns> public static IFutureValue <TResult> AddAsFutureValue <TSource, TResult>(this IQueryBatch batch, IQueryable <TSource> query, Expression <Func <IQueryable <TSource>, TResult> > selector) { return(AddAsFutureValue(batch, For(query, selector))); }
/// <summary> /// Adds a query to the batch, returning it as an <see cref="IFutureEnumerable{T}"/>. /// </summary> /// <param name="batch">The batch.</param> /// <param name="query">The query.</param> /// <typeparam name="TResult">The type of the query result elements.</typeparam> /// <returns>A future query which execution will be handled by the batch.</returns> public static IFutureEnumerable <TResult> AddAsFuture <TResult>(this IQueryBatch batch, IQueryable <TResult> query) { return(AddAsFuture(batch, For(query))); }
/// <summary> /// Adds a query to the batch. /// </summary> /// <param name="batch">The batch.</param> /// <param name="query">The query.</param> /// <param name="selector">An aggregation function to apply to <paramref name="query"/>.</param> /// <param name="afterLoad">Callback to execute when query is loaded. Loaded results are provided as action parameter.</param> /// <typeparam name="TSource">The type of the query elements before aggregation.</typeparam> /// <typeparam name="TResult">The type resulting of the query result aggregation.</typeparam> /// <exception cref="InvalidOperationException">Thrown if the batch has already been executed.</exception> /// <exception cref="ArgumentNullException">Thrown if <paramref name="query"/> is <see langword="null"/>.</exception> /// <returns>The batch instance for method chain.</returns> public static IQueryBatch Add <TSource, TResult>(this IQueryBatch batch, IQueryable <TSource> query, Expression <Func <IQueryable <TSource>, TResult> > selector, Action <TResult> afterLoad = null) { return(batch.Add(For(query, selector), afterLoad == null ? (Action <IList <TResult> >)null : list => afterLoad(list.FirstOrDefault()))); }
public FutureResult(IQueryBatch queryBatch, int queryIndex) { this.queryBatch = queryBatch; this.queryIndex = queryIndex; }
/// <summary> /// Adds a query to the batch, returning it as an <see cref="IFutureValue{T}"/>. /// </summary> /// <param name="batch">The batch.</param> /// <param name="query">The query.</param> /// <typeparam name="TResult">The type of the query result elements.</typeparam> /// <returns>A future query which execution will be handled by the batch.</returns> public static IFutureValue <TResult> AddAsFutureValue <TResult>(this IQueryBatch batch, DetachedCriteria query) { return(AddAsFutureValue(batch, For <TResult>(query))); }
/// <summary> /// Adds a query to the batch. /// </summary> /// <param name="batch">The batch.</param> /// <param name="query">The query.</param> /// <param name="afterLoad">Callback to execute when query is loaded. Loaded results are provided as action parameter.</param> /// <typeparam name="TResult">The type of the query result elements.</typeparam> /// <exception cref="InvalidOperationException">Thrown if the batch has already been executed.</exception> /// <exception cref="ArgumentNullException">Thrown if <paramref name="query"/> is <see langword="null"/>.</exception> /// <returns>The batch instance for method chain.</returns> public static IQueryBatch Add <TResult>(this IQueryBatch batch, ICriteria query, Action <IList <TResult> > afterLoad = null) { return(batch.Add(For <TResult>(query), afterLoad)); }
/// <inheritdoc /> public abstract void EstablishFor(IShard shard, IQueryBatch queryBatch, string key = null);