Beispiel #1
0
        public MySettingsConfigMoal GetConfigDetails()
        {
            MySettingsConfigMoal MySettingsConfigMoal = new MySettingsConfigMoal();

            try
            {
                var builder = new ConfigurationBuilder()
                              .SetBasePath(Directory.GetCurrentDirectory())
                              .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
                              .AddUserSecrets <Program>()
                              .AddEnvironmentVariables();

                IConfigurationRoot configuration = builder.Build();
                var mySettingsConfig             = new MySettingsConfig();
                configuration.GetSection("MySettings").Bind(mySettingsConfig);



                MySettingsConfigMoal.Connectionstring = configuration.GetConnectionString("DefaultConnection");
            }
            catch
            {
            }

            return(MySettingsConfigMoal);
        }
Beispiel #2
0
        public void StartProcess()
        {
            Program obj = new Program();

            try
            {
                var builder = new ConfigurationBuilder()
                              .SetBasePath(Directory.GetCurrentDirectory())
                              .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
                              .AddUserSecrets <Program>()
                              .AddEnvironmentVariables();

                IConfigurationRoot configuration = builder.Build();
                var mySettingsConfig             = new MySettingsConfig();
                configuration.GetSection("MySettings").Bind(mySettingsConfig);


                string interval = mySettingsConfig.IntervalInMinutes;

                _CustomerKeyword = mySettingsConfig.Customerkeyword.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                _TicketKeyword   = mySettingsConfig.Ticketkeyword.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);

                double intervalInMinutes = Convert.ToDouble(interval);

                Thread _Individualprocessthread = new Thread(new ThreadStart(InvokeMethod));
                _Individualprocessthread.Start();
            }
            catch
            {
            }
        }
Beispiel #3
0
        public void InvokeMethod()
        {
            var builder = new ConfigurationBuilder()
                          .SetBasePath(Directory.GetCurrentDirectory())
                          .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
                          .AddUserSecrets <Program>()
                          .AddEnvironmentVariables();

            IConfigurationRoot configuration = builder.Build();
            var mySettingsConfig             = new MySettingsConfig();

            configuration.GetSection("MySettings").Bind(mySettingsConfig);

            string interval = mySettingsConfig.IntervalInMinutes;

            int intervalInMinutes = Convert.ToInt32(interval);

            while (true)
            {
                GetConnectionStrings();

                Thread.Sleep(intervalInMinutes);
            }
        }