Beispiel #1
0
        static void MixedHandle()
        {
            var dataPersistence = DataPersistenceFactory.CreateDataPersistence <ShareConfig.DataPersistence.Redis.RedisDataPersistence>("localhost:56379");
            var config          = ConfigFactory.CreateConfig <ConsulConfig>(dataPersistence);

            while (true)
            {
                Console.WriteLine("1、Load Config from data  2、Read Config  3、Synchronize Config  4、Remove Config 5、Exit");
                switch (Console.ReadLine())
                {
                case "1":
                    LoadConfig(dataPersistence, config).GetAwaiter().GetResult();
                    break;

                case "2":
                    ReadConfig(config).GetAwaiter().GetResult();
                    break;

                case "3":
                    SynchronizeConfg(dataPersistence, config).GetAwaiter().GetResult();
                    break;

                case "4":
                    RemoveConfig(dataPersistence, config).GetAwaiter().GetResult();
                    return;

                case "5":
                    return;
                }
            }
        }
        public Service1()
        {
            InitializeComponent();
            JobHostConfiguration config = ConfigFactory.CreateConfig();

            jobHost = new JobHost(config);
        }
Beispiel #3
0
 private void EnsureMapConfiguration()
 {
     if (_config == null)
     {
         RaiseCreateMapRequestConfig();
         _config = ConfigFactory.CreateConfig(Context);
         RaiseMapRequestConfigCreated();
     }
 }
Beispiel #4
0
    public Config()
    {
        //初始化ASP.NET内置对象
        Response    = System.Web.HttpContext.Current.Response;
        Request     = System.Web.HttpContext.Current.Request;
        Server      = System.Web.HttpContext.Current.Server;
        Session     = System.Web.HttpContext.Current.Session;
        Application = System.Web.HttpContext.Current.Application;

        tools = ToolsFactory.CreateTools();
        MyBLL = ConfigFactory.CreateConfig();
    }
Beispiel #5
0
        /// <summary>
        /// Consuls the handle.
        /// </summary>
        /// <returns>The handle.</returns>
        static async Task ConsulHandle()
        {
            try
            {
                var config = ConfigFactory.CreateConfig <ConsulConfig>();

                while (true)
                {
                    try
                    {
                        Console.WriteLine("1、Add Config  2、Query Config  3、Delete Config");
                        switch (Console.ReadLine())
                        {
                        case "1":
                            await AddConfig(config);

                            break;

                        case "2":
                            await QueryConfig(config);

                            break;

                        case "3":
                            await RemoveConfig(config);

                            break;
                        }
                    }
                    catch (Exception exc)
                    {
                        Console.WriteLine($"Exception:{exc.Message}");
                    }
                }
            }
            catch (Exception exc)
            {
                Console.WriteLine(exc.Message);
                return;
            }
        }