public override void Load()
        {
            Dictionary <string, string> consulKeys = _consulClient.ReadKeysRecursively();
            Dictionary <string, string> config     = _parser.ParseConfiguration(consulKeys, _consulKey);

            foreach (var kvPair in config)
            {
                Set(kvPair.Key, kvPair.Value);
            }
        }
        public List <Users> GetDataTable(string sql)
        {
            configuration.ParseConfiguration();


            connectionInformix.CreateConnection(configuration.configurationConnect, sql);
            connectionInformix.OpenConnection();

            listcolumn = connectionInformix.GetDataReader();
            foreach (var column in listcolumn)
            {
                Users user = new Users();
                user.id             = column[0];
                user.surname        = column[1];
                user.name           = column[2];
                user.patronymicName = column[3];
                users.Add(user);
            }
            connectionInformix.CloseConnection();

            return(users);
        }
Exemple #3
0
        public StylizeEngine(IConfigurationParser configurationParser)
        {
            if (configurationParser == null) { throw new ArgumentNullException(nameof(configurationParser)); }

            Log.WriteVerbose("Initializing MEF");
            var catalog = new AggregateCatalog(
                new AssemblyCatalog(Assembly.GetExecutingAssembly().Location));
            string currentDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
            foreach (string exportAssemblyName in configurationParser.ExportAssemblyNames)
            {
                string exportAssemblyPath = Path.IsPathRooted(exportAssemblyName)
                    ? exportAssemblyName
                    : Path.Combine(currentDirectory, exportAssemblyName);
                catalog.Catalogs.Add(new AssemblyCatalog(exportAssemblyPath));
            }

            this.container = new CompositionContainer(catalog);
            IReadOnlyList<IOption> supportedOptions = this.container.GetExportedValues<IOption>(
                ExportStylizeOptionAttribute.OptionContractName).ToList();

            Log.WriteVerbose("Parsing configuration");
            StylizeConfiguration configuration = configurationParser.ParseConfiguration(supportedOptions);
            this.globalOptions = configuration.GlobalOptions;

            Log.WriteVerbose("Loading exports");
            if (!String.IsNullOrEmpty(configuration.RepositoryName))
            {
                this.repository = this.container.GetExportedValue<ISourceRepository>(configuration.RepositoryName);
                this.container.ComposeExportedValue(ExportSourceRepositoryAttribute.CurrentName, this.repository);
            }

            this.exclusionMatchers = this.container.GetExports<IDocumentMatcher, INamedMetadata>(
                configuration.ExclusionMatchers);

            IReadOnlyList<Export<IStyleRule, StyleRuleMetadata>> rules =
                this.container.GetExports<IStyleRule, StyleRuleMetadata>(configuration.Rules);
            this.languageRuleMap = OrderAndMapRules(rules);

            Log.WriteVerbose("Engine initialized");
        }