/// <summary> /// Asynchronously creates a <see cref="RecordSetReader"/> instance capable to read <paramref name="provider"/> /// execution results and bound to the specified <paramref name="context"/>. /// </summary> /// <param name="context">The <see cref="EnumerationContext"/> instance associated with the query execution.</param> /// <param name="provider">The <see cref="ExecutableProvider"/> to be processed.</param> /// <param name="token">The <see cref="CancellationToken"/> allowing to cancel query execution if necessary.</param> /// <returns><see cref="RecordSetReader"/> instance ready for enumeration. /// This means query is already executed but no records have been read yet.</returns> public static async ValueTask <RecordSetReader> CreateAsync( EnumerationContext context, ExecutableProvider provider, CancellationToken token) { var recordSet = new RecordSetReader(context, provider, token); await recordSet.Prepare(true).ConfigureAwait(false); return(recordSet); }
/// <summary> /// Creates a <see cref="RecordSetReader"/> instance capable to read <paramref name="provider"/> /// execution results and bound to the specified <paramref name="context"/>. /// </summary> /// <param name="context">The <see cref="EnumerationContext"/> instance associated with the query execution.</param> /// <param name="provider">The <see cref="ExecutableProvider"/> to be processed.</param> /// <returns><see cref="RecordSetReader"/> instance ready for enumeration. /// This means query is already executed but no records have been read yet.</returns> public static RecordSetReader Create(EnumerationContext context, ExecutableProvider provider) { var recordSet = new RecordSetReader(context, provider); var task = recordSet.Prepare(false); task.GetAwaiter().GetResult(); // Ensure exception, if any, is being thrown return(recordSet); }