public IScalarResolver <T> InstantiateResolver <T>(string value) { var argsBuilder = new ScalarResolverArgsBuilder(ServiceLocator, Context); argsBuilder.Setup(value); argsBuilder.Build(); var factory = ServiceLocator.GetScalarResolverFactory(); var resolver = factory.Instantiate <T>(argsBuilder.GetArgs()); return(resolver); }
public IScalarResolver <T> InstantiateResolver <T>(ScalarXml scalarXml) { var argsBuilder = new ScalarResolverArgsBuilder(ServiceLocator, Context); argsBuilder.Setup(scalarXml.BaseItem, scalarXml.Settings, Scope); argsBuilder.Build(); var factory = ServiceLocator.GetScalarResolverFactory(); var resolver = factory.Instantiate <T>(argsBuilder.GetArgs()); return(resolver); }
public IScalarResolver <decimal> InstantiateResolver(ScalarXml scalarXml) { var argsBuilder = new ScalarResolverArgsBuilder(serviceLocator); argsBuilder.Setup(scalarXml.BaseItem); argsBuilder.Setup(scalarXml.Settings); argsBuilder.Setup(variables); argsBuilder.Build(); var factory = serviceLocator.GetScalarResolverFactory(); var resolver = factory.Instantiate <decimal>(argsBuilder.GetArgs()); return(resolver); }
public IEnumerable <IQueryParameter> BuildParameters(IEnumerable <QueryParameterXml> parametersXml) { foreach (var parameterXml in parametersXml) { var stringWithoutSpecialChars = parameterXml.StringValue.Replace("\r", "").Replace("\n", "").Replace("\t", "").Trim(); var builder = new ScalarResolverArgsBuilder(serviceLocator, new Context(Variables)); builder.Setup(stringWithoutSpecialChars); builder.Build(); var args = builder.GetArgs(); var factory = serviceLocator.GetScalarResolverFactory(); var resolver = factory.Instantiate(args); yield return(new QueryParameter(parameterXml.Name, parameterXml.SqlType, resolver)); } }
private ResultSetResolverArgs BuildCsvResolverArgs(string path) { Trace.WriteLineIf(Extensibility.NBiTraceSwitch.TraceVerbose, "ResultSet defined in external CSV file."); var builder = new ScalarResolverArgsBuilder(serviceLocator); builder.Setup(path); builder.Setup(settings); builder.Setup(globalVariables); builder.Build(); var argsPath = builder.GetArgs(); var factory = serviceLocator.GetScalarResolverFactory(); var resolverPath = factory.Instantiate <string>(argsPath); return(new CsvResultSetResolverArgs(resolverPath, settings?.BasePath, settings?.CsvProfile)); }
public IScalarResolver InstantiateResolver(ColumnType columnType, string value) { var argsBuilder = new ScalarResolverArgsBuilder(ServiceLocator, Context); argsBuilder.Setup(value); argsBuilder.Build(); var args = argsBuilder.GetArgs(); var factory = ServiceLocator.GetScalarResolverFactory(); switch (columnType) { case ColumnType.Text: return(factory.Instantiate <string>(args)); case ColumnType.Numeric: return(factory.Instantiate <decimal>(args)); case ColumnType.DateTime: return(factory.Instantiate <DateTime>(args)); case ColumnType.Boolean: return(factory.Instantiate <bool>(args)); default: throw new ArgumentOutOfRangeException(); } }