protected virtual IDbCommand GetCommand(ExecutionXml executionXml) { var commandBuilder = new CommandBuilder(); var connectionString = executionXml.Item.GetConnectionString(); var commandText = (executionXml.Item as QueryableXml).GetQuery(); IEnumerable <IQueryParameter> parameters = null; IEnumerable <IQueryTemplateVariable> variables = null; int timeout = 0; if (executionXml.BaseItem is QueryXml) { var builder = new QueryResolverArgsBuilder(); parameters = builder.BuildParameters(((QueryXml)executionXml.BaseItem).GetParameters()); variables = ((QueryXml)executionXml.BaseItem).GetVariables(); timeout = ((QueryXml)executionXml.BaseItem).Timeout; } if (executionXml.BaseItem is ReportXml) { var builder = new QueryResolverArgsBuilder(); parameters = builder.BuildParameters(((ReportXml)executionXml.BaseItem).GetParameters()); } var cmd = commandBuilder.Build(connectionString, commandText, parameters, variables, timeout); if (executionXml.BaseItem is ReportXml) { cmd.CommandType = ((ReportXml)executionXml.BaseItem).GetCommandType(); } return(cmd); }
protected virtual IResultSetService InstantiateSystemUnderTest(ExecutionXml executionXml) { var commandFactory = new CommandProvider(); var argsBuilder = new QueryResolverArgsBuilder(ServiceLocator); var connectionString = executionXml.Item.GetConnectionString(); var statement = (executionXml.Item as QueryableXml).GetQuery(); IEnumerable <IQueryParameter> parameters = null; IEnumerable <IQueryTemplateVariable> templateVariables = null; int timeout = 0; var commandType = CommandType.Text; if (executionXml.BaseItem is QueryXml) { parameters = argsBuilder.BuildParameters(((QueryXml)executionXml.BaseItem).GetParameters()); templateVariables = ((QueryXml)executionXml.BaseItem).GetTemplateVariables(); timeout = ((QueryXml)executionXml.BaseItem).Timeout; } if (executionXml.BaseItem is ReportXml) { parameters = argsBuilder.BuildParameters(((ReportXml)executionXml.BaseItem).GetParameters()); } if (executionXml.BaseItem is ReportXml) { commandType = ((ReportXml)executionXml.BaseItem).GetCommandType(); } var queryArgs = new QueryResolverArgs(statement, connectionString, parameters, templateVariables, new TimeSpan(0, 0, timeout), commandType); var args = new QueryResultSetResolverArgs(queryArgs); var factory = ServiceLocator.GetResultSetResolverFactory(); var resolver = factory.Instantiate(args); var builder = new ResultSetServiceBuilder(); builder.Setup(resolver); var service = builder.GetService(); return(service); }
protected virtual IResultSetService InstantiateSystemUnderTest(ExecutionXml executionXml) { var commandBuilder = new CommandBuilder(); var connectionString = executionXml.Item.GetConnectionString(); var commandText = (executionXml.Item as QueryableXml).GetQuery(); IEnumerable <IQueryParameter> parameters = null; IEnumerable <IQueryTemplateVariable> variables = null; int timeout = 0; if (executionXml.BaseItem is QueryXml) { var paramBuilder = new QueryResolverArgsBuilder(); parameters = paramBuilder.BuildParameters(((QueryXml)executionXml.BaseItem).GetParameters()); variables = ((QueryXml)executionXml.BaseItem).GetVariables(); timeout = ((QueryXml)executionXml.BaseItem).Timeout; } if (executionXml.BaseItem is ReportXml) { var paramBuilder = new QueryResolverArgsBuilder(); parameters = paramBuilder.BuildParameters(((ReportXml)executionXml.BaseItem).GetParameters()); } var cmd = commandBuilder.Build(connectionString, commandText, parameters, variables, timeout); if (executionXml.BaseItem is ReportXml) { cmd.CommandType = ((ReportXml)executionXml.BaseItem).GetCommandType(); } var args = new QueryResultSetResolverArgs(new DbCommandQueryResolverArgs(cmd)); var factory = new ResultSetResolverFactory(); var resolver = factory.Instantiate(args); var builder = new ResultSetServiceBuilder(); builder.Setup(resolver); var service = builder.GetService(); return(service); }
protected virtual IQuery GetQuery(ExecutionXml executionXml) { var commandFactory = ServiceLocator.GetCommandFactory(); var connectionString = executionXml.Item.GetConnectionString(); var commandText = (executionXml.Item as QueryableXml).GetQuery(); IEnumerable <IQueryParameter> parameters = null; IEnumerable <IQueryTemplateVariable> variables = null; var commandType = CommandType.Text; int timeout = 0; if (executionXml.BaseItem is QueryXml) { var builder = new QueryResolverArgsBuilder(ServiceLocator); parameters = builder.BuildParameters(((QueryXml)executionXml.BaseItem).GetParameters()); variables = ((QueryXml)executionXml.BaseItem).GetVariables(); timeout = ((QueryXml)executionXml.BaseItem).Timeout; } if (executionXml.BaseItem is ReportXml) { var builder = new QueryResolverArgsBuilder(ServiceLocator); parameters = builder.BuildParameters(((ReportXml)executionXml.BaseItem).GetParameters()); } if (executionXml.BaseItem is ReportXml) { commandType = ((ReportXml)executionXml.BaseItem).GetCommandType(); } var queryArgs = new QueryResolverArgs(commandText, connectionString, parameters, variables, new TimeSpan(0, 0, timeout), commandType); var factory = ServiceLocator.GetQueryResolverFactory(); var resolver = factory.Instantiate(queryArgs); var query = resolver.Execute(); return(query); }