예제 #1
0
        public static int Main(string[] args)
        {
            var running = new SemaphoreSlim(1);

            Parser.Default.ParseArguments <Options>(args)
            .WithParsed(opts =>
            {
                try
                {
                    WriteLine($"Selected engine: {opts.Engine}");
                    running.Wait();
                    Instance           = TempDbFactory.Create(opts);
                    Instance.Disposed += HandleAutoDisposal;
                    WriteLine($"Connection string: {Instance.ConnectionString}");
                    _shell   = WaitForStopCommand();
                    Instance = null;
                }
                catch (ShowSupportedEngines ex)
                {
                    WriteLine(ex.Message);
                }
                finally
                {
                    running.Release();
                }
            })
            .WithNotParsed(errors =>
            {
                errors.ForEach(e => WriteLine(e.ToString()));
            });
            AppDomain.CurrentDomain.ProcessExit += OnAppExit;
            Console.CancelKeyPress += OnCancelKeyPress;
            running.Wait();
            return(0);
        }
예제 #2
0
        public static int Main(string[] args)
        {
            var running = new SemaphoreSlim(1);

            Parser.Default.ParseArguments <Options>(args)
            .WithParsed(opts =>
            {
                try
                {
                    WriteLine($"Selected engine: {opts.Engine}");
                    running.Wait();
                    Instance = TempDbFactory.Create(opts);
                    WriteLine($"Connection string: {Instance.ConnectionString}");
                    WaitForStopCommand(Instance);
                    Instance = null;
                }
                catch (ShowSupportedEngines ex)
                {
                    WriteLine(ex.Message);
                }
                finally
                {
                    running.Release();
                }
            })
            .WithNotParsed(errors =>
            {
                errors.ForEach(e => WriteLine(e.ToString()));
            });
            running.Wait();
            return(0);
        }