/// <summary> /// Returns text from <code>RequestHandler</code> as single string. /// </summary> /// <param name="connection">Connection string to the target database where results will be fetched.</param> /// <returns>Async tatsk with ActionResult contianing the results.</returns> public static Task <string> GetString(this RequestHandler rh, string connection) { var pipe = new QueryPipe(connection); var pipeAdapter = new TSqlCommandAdapter(pipe); return(rh.GetString(pipeAdapter)); }
private static IQueryPipe CreateQueryPipe(Option options, IServiceProvider sp) { var pipe = new QueryPipe(new SqlConnection(options.ReadScaleOut ? (options.ReadOnlyConnString ?? (options.ConnString + "ApplicationIntent=ReadOnly;")) : options.ConnString)); var logger = TryGetLogger <QueryPipe>(sp); if (logger != null) { pipe.AddLogger(logger); } if (options.SessionContext != null && options.SessionContext.Count >= 1) { foreach (var rls in options.SessionContext) { pipe.AddContextVariable(rls.Key, () => rls.Value(sp)); } } return(pipe); }