public Task OutputResultsAsync(IQueryRunner runner) { return Task.Factory.StartNew(() => { try { runner.OutputMessage("Query Started"); var start = DateTime.Now; var dq = runner.QueryText; var res = runner.ExecuteQuery(dq); var end = DateTime.Now; var durationMs = (end - start).TotalMilliseconds; // TODO write results to Excel runner.Host.OutputStaticResult(res, runner.SelectedWorksheet); //runner.ResultsTable = res; runner.OutputMessage( string.Format("Query Completed ({0} row{1} returned)", res.Rows.Count, res.Rows.Count == 1 ? "" : "s"), durationMs); runner.ActivateResults(); runner.QueryCompleted(); } catch (Exception ex) { runner.ActivateOutput(); runner.OutputError(ex.Message); } }); }
public void OutputResults(IQueryRunner runner) { try { runner.OutputMessage("Query Started"); var start = DateTime.Now; var dq = runner.QueryText; runner.ExecuteQueryAsync(dq).ContinueWith((antecendant) => { var end = DateTime.Now; var durationMs = (end - start).TotalMilliseconds; var res = antecendant.Result; // TODO write results to Excel runner.Host.OutputStaticResult(res, runner.SelectedWorksheet); //runner.ResultsTable = res; runner.OutputMessage( string.Format("Query Completed ({0} row{1} returned)", res.Rows.Count, res.Rows.Count == 1 ? "" : "s"), durationMs); runner.ActivateResults(); runner.QueryCompleted(); },TaskScheduler.FromCurrentSynchronizationContext()); } catch (Exception ex) { runner.ActivateOutput(); runner.OutputError(ex.Message); } }
static IEnumerable <TElement> GetGrouping( IQueryRunner runner, List <ParameterAccessor> parameterAccessor, TKey key, Func <IDataContext, TKey, object[], IQueryable <TElement> > itemReader) { return(new GroupByBuilder.GroupByContext.Grouping <TKey, TElement>(key, runner, parameterAccessor, itemReader)); }
// This is the core method that handles the output of the results public Task OutputResultsAsync(IQueryRunner runner) { // Read the AutoFormat option from the options singleton bool autoFormat = _options.ResultAutoFormat; return(Task.Run(() => { long durationMs = 0; int queryCnt = 1; try { runner.OutputMessage("Query Started"); var sw = Stopwatch.StartNew(); var dq = runner.QueryText; //var res = runner.ExecuteDataTableQuery(dq); using (var dataReader = runner.ExecuteDataReaderQuery(dq)) { if (dataReader != null) { Log.Verbose("Start Processing Grid DataReader (Elapsed: {elapsed})", sw.ElapsedMilliseconds); runner.ResultsDataSet = dataReader.ConvertToDataSet(autoFormat); Log.Verbose("End Processing Grid DataReader (Elapsed: {elapsed})", sw.ElapsedMilliseconds); sw.Stop(); durationMs = sw.ElapsedMilliseconds; var rowCnt = runner.ResultsDataSet.Tables[0].Rows.Count; foreach (DataTable tbl in runner.ResultsDataSet.Tables) { runner.OutputMessage( string.Format("Query {2} Completed ({0:N0} row{1} returned)", tbl.Rows.Count, tbl.Rows.Count == 1 ? "" : "s", queryCnt)); queryCnt++; } runner.RowCount = rowCnt; // activate the result only when Counters are not selected... runner.ActivateResults(); runner.OutputMessage("Query Batch Completed", durationMs); } else { runner.OutputError("Query Batch Completed with errors", durationMs); } } } catch (Exception ex) { Log.Error("{class} {method} {message} {stacktrace}", "ResultsTargetGrid", "OutputQueryResultsAsync", ex.Message, ex.StackTrace); runner.ActivateOutput(); runner.OutputError(ex.Message); runner.OutputError("Query Batch Completed with erros", durationMs); } finally { runner.QueryCompleted(); } })); }
public GetStaffProcessor( IDapperUnitOfWork dapperUnitOfWork, IQuery <GetStaff, OrgStaff> query, IQueryRunner runner) : base(dapperUnitOfWork) { _query = query; _runner = runner; }
/// <summary> /// INSERT INTO (...) VALUES ( ...); SELECT LAST_IDENTITY() /// </summary> public static TIdentity Insert <T, TIdentity>(this IQueryRunner runner, FromQuery <T> query, Expression <Action <InsertBuilder <T> > > insertExpr) where T : new() { var stmtList = new StatementList(); stmtList.Insert(query, insertExpr); var select = stmtList.Select(ctx => Function.LastInsertIdentity <TIdentity>(ctx)); return(runner.ExecuteQuery(select).FirstOrDefault()); }
public GetInvoiceProcessor( IDapperUnitOfWork dapperUnitOfWork, IQuery <GetOrganizationEntity, Invoice> query, IQueryRunner runner) : base(dapperUnitOfWork) { _query = query; _runner = runner; }
public GetJobTimesheetProcessor( IDapperUnitOfWork dapperUnitOfWork, IQuery <GetJobTimesheet, JobTimesheet> query, IQueryRunner runner) : base(dapperUnitOfWork) { _query = query; _runner = runner; }
public GetInvoiceCostItemProcessor( IDapperUnitOfWork dapperUnitOfWork, IQuery <GetInvoiceCostItem, InvoiceCostItem> query, IQueryRunner runner) : base(dapperUnitOfWork) { _query = query; _runner = runner; }
public GetJobByIdRequestProcessor( IDapperUnitOfWork dapperUnitOfWork, IQuery <GetJob, JobWithDetailsPoco> query, IQueryRunner runner) : base(dapperUnitOfWork) { _query = query; _runner = runner; }
private IResultSummary Execute(IQueryRunner runner, string query) { var result = runner.Run(query); Thread.Sleep(_rnd.Next(100)); result.Consume(); Thread.Sleep(_rnd.Next(100)); return(result.Consume()); }
public GetOAuthClientProcessor( IDapperUnitOfWork dapperUnitOfWork, IQuery <GetAuthClient, OAuthClient> query, IQueryRunner runner) : base(dapperUnitOfWork) { _query = query; _runner = runner; }
public GetCustomerAddressProcessor( IDapperUnitOfWork dapperUnitOfWork, IQuery <GetCustomerAddress, CustomerAddressPoco> query, IQueryRunner runner) : base(dapperUnitOfWork) { _query = query; _runner = runner; }
public GetContactProcessor( IDapperUnitOfWork dapperUnitOfWork, IQuery <GetContact, Contact> query, IQueryRunner runner) : base(dapperUnitOfWork) { _query = query; _runner = runner; }
internal override IEnumerable <T> InMemorySelect(IQueryRunner runner) { var context = new SelectorContext(runner); return(new List <T>() { SelectFunction(context) }); }
public GetTaskDefinitionByIdRequestProcessor( IDapperUnitOfWork dapperUnitOfWork, IQuery <GetTaskDefinition, TaskDefinition> query, IQueryRunner runner) : base(dapperUnitOfWork) { _query = query; _runner = runner; }
public GetQuoteProcessor( IDapperUnitOfWork dapperUnitOfWork, IQuery <GetQuote, Quote> query, IQueryRunner runner) : base(dapperUnitOfWork) { _query = query; _runner = runner; }
public GetJobTaskProcessor( IDapperUnitOfWork dapperUnitOfWork, IQuery <GetJobTask, JobTask> query, IQueryRunner runner) : base(dapperUnitOfWork) { _query = query; _runner = runner; }
public HooksModule(IQueryRunner query, ICommandDispatcher command) : base("/api/admin") { Get("/projects", async _ => await query.Query(new GetProjects())); Post("/project/{projectId}/setup_hooks", async _ => { await command.Execute(new SetupProjectHooks(_.projectId)); return(new { ok = true }); }); }
public UpdateJobCostItemProcessor( IDapperUnitOfWork dapperUnitOfWork, IPatchEntityAdapter adapter, IQuery <GetJobCostItem, JobCostItem> getQuery, IQueryRunner getRunner, ICommand <UpdateJobCostItem> updateQuery, ICommandExecutor updateExecutor) : base(dapperUnitOfWork, adapter, getQuery, getRunner, updateQuery, updateExecutor) { }
public UpdateTaskDefinitionProcessor( IDapperUnitOfWork dapperUnitOfWork, IPatchEntityAdapter adapter, IQuery <GetTaskDefinition, TaskDefinition> getQuery, IQueryRunner getRunner, ICommand <UpdateTaskDefinition> updateCommand, ICommandExecutor updateExecutor) : base(dapperUnitOfWork, adapter, getQuery, getRunner, updateCommand, updateExecutor) { }
public UpdateContactProcessor( IDapperUnitOfWork dapperUnitOfWork, IPatchEntityAdapter patchEntityAdapter, IQuery <GetContact, Contact> getQuery, IQueryRunner getQueryRunner, ICommand <UpdateContact> updateQuery, ICommandExecutor updateCommandExecutor) : base(dapperUnitOfWork, patchEntityAdapter, getQuery, getQueryRunner, updateQuery, updateCommandExecutor) { }
public UpdateQuoteProcessor( IDapperUnitOfWork dapperUnitOfWork, IPatchEntityAdapter adapter, IQuery <GetQuote, Quote> getQuery, IQueryRunner getRunner, ICommand <UpdateQuote> updateCommand, ICommandExecutor updateExecutor) : base(dapperUnitOfWork, adapter, getQuery, getRunner, updateCommand, updateExecutor) { }
public UpdateJobTimesheetProcessor( IDapperUnitOfWork dapperUnitOfWork, IPatchEntityAdapter adapter, IQuery <GetJobTimesheet, JobTimesheet> query, IQueryRunner runner, ICommand <UpdateJobTimesheet> command, ICommandExecutor executor) : base(dapperUnitOfWork, adapter, query, runner, command, executor) { }
public UpdateInvoiceProcessor( IDapperUnitOfWork dapperUnitOfWork, IPatchEntityAdapter patchAdapter, IQuery <GetOrganizationEntity, Invoice> getQuery, IQueryRunner getRunner, ICommand <UpdateInvoice> updateQuery, ICommandExecutor updateExecutor) : base(dapperUnitOfWork, patchAdapter, getQuery, getRunner, updateQuery, updateExecutor) { }
public UpdateJobProcessor( IDapperUnitOfWork dapperUnitOfWork, IPatchEntityAdapter adapter, IQuery <GetJob, JobWithDetailsPoco> getQuery, IQueryRunner getRunner, ICommand <UpdateJob> updateQuery, ICommandExecutor updateExecutor) : base(dapperUnitOfWork, adapter, getQuery, getRunner, updateQuery, updateExecutor) { }
public UpdateJobTaskProcessor( IDapperUnitOfWork dapperUnitOfWork, IPatchEntityAdapter patchEntityAdapter, ICommand <UpdateJobTask> command, ICommandExecutor executor, IQuery <GetJobTask, JobTask> query, IQueryRunner runner) : base(dapperUnitOfWork, patchEntityAdapter, query, runner, command, executor) { }
public UpdateCustomerProcessor( IDapperUnitOfWork dapperUnitOfWork, IPatchEntityAdapter patchAdapter, IQuery <GetCustomer, Customer> getQuery, IQueryRunner getRunner, ICommand <UpdateCustomer> updateQuery, ICommandExecutor updateExecutor) : base(dapperUnitOfWork, patchAdapter, getQuery, getRunner, updateQuery, updateExecutor) { }
public UpdateInvoiceCostItemProcessor( IDapperUnitOfWork dapperUnitOfWork, IPatchEntityAdapter patchEntityAdapter, ICommand <UpdateInvoiceCostItem> command, ICommandExecutor executor, IQuery <GetInvoiceCostItem, InvoiceCostItem> query, IQueryRunner runner) : base(dapperUnitOfWork, patchEntityAdapter, query, runner, command, executor) { }
public WorkerUserService(IQueryRunner queryRunner, IBaseRepository <WorkerUser> userRepository, IBaseRepository <TypeWorkerUser> typeWorkerUserRepository, IRepository repository) { this.queryRunner = queryRunner; this.userRepository = userRepository; this.typeWorkerUserRepository = typeWorkerUserRepository; this.repository = repository; }
static IEnumerable <T> ExecuteSubQuery( IQueryRunner queryRunner, object parentObject, Func <IDataContext, object, IEnumerable <T> > queryReader) { using (var db = queryRunner.DataContext.Clone(true)) foreach (var item in queryReader(db, parentObject)) { yield return(item); } }
public void EvaluateInMemory(IQueryRunner runner) { if (Variable.PlaceholderType == SqlPlaceholderType.SessionVariableName) { var context = new SelectorContext <T>(runner, null); Variable.Value = ValueFunction(context); } else { throw new InvalidOperationException("Uhndlet vrbitype"); } }
public void Initialize() { shimContext = ShimsContext.Create(); queryFinder = A.Fake<IQueryFinder>(); queryDefinition = new ShimQueryDefinition(); queryRunner = A.Fake<IQueryRunner>(); queryDefinition.QueryTextGet = () => "SELECT System.ID, System.Title from workitems"; A.CallTo(() => queryFinder.FindQuery(project, queryPath, queryName)) .Returns(queryDefinition); }
private void OutputResults(IQueryRunner runner) { try { runner.OutputMessage("Query Started"); var sw = Stopwatch.StartNew(); var dq = runner.QueryText; var res = runner.ExecuteQuery(dq); sw.Stop(); var durationMs = sw.ElapsedMilliseconds; runner.OutputMessage(string.Format("Query Completed ({0:N0} row{1} returned)", res.Rows.Count, res.Rows.Count == 1 ? "" : "s"), durationMs); runner.RowCount = res.Rows.Count; runner.SetResultsMessage("Query timings sent to output tab", OutputTargets.Timer); //runner.QueryCompleted(); runner.ActivateOutput(); } catch (Exception ex) { runner.ActivateOutput(); runner.OutputError(ex.Message); } }
public TFSRepository(IQueryFinder queryFinder, IQueryRunner queryRunner) { this.queryFinder = queryFinder; this.queryRunner = queryRunner; }
public Task OutputResultsAsync(IQueryRunner runner) { return Task.Factory.StartNew(() => OutputResults(runner)); }
public Task OutputResultsAsync(IQueryRunner runner) { return Task.Factory.StartNew(() => { try { runner.OutputMessage("Query Started"); var sw = Stopwatch.StartNew(); var dq = runner.QueryText; var res = runner.ExecuteQuery(dq); if (res != null) { sw.Stop(); var durationMs =sw.ElapsedMilliseconds; runner.ResultsTable = res; runner.OutputMessage( string.Format("Query Completed ({0:N0} row{1} returned)", res.Rows.Count, res.Rows.Count == 1 ? "" : "s"), durationMs); runner.RowCount = res.Rows.Count; // activate the result only when Counters are not selected... runner.ActivateResults(); //runner.QueryCompleted(); } } catch (Exception ex) { runner.ActivateOutput(); runner.OutputError(ex.Message); } }); }