예제 #1
0
파일: ScalarHelper.cs 프로젝트: ywscr/NBi
        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);
        }
예제 #2
0
파일: ScalarHelper.cs 프로젝트: ywscr/NBi
        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);
        }
예제 #3
0
        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);
        }
예제 #4
0
        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));
        }
예제 #6
0
파일: ScalarHelper.cs 프로젝트: ywscr/NBi
        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();
            }
        }