예제 #1
0
        private static void Main(string[] args)
        {
            try
            {
                Cmd.WriteHeader("Initialising...");
                var upTheDb = new UpTheDb(ConnectionString);
                if (!upTheDb.DatabaseExists())
                {
                    upTheDb.CreateDatabase();
                }
                if (!upTheDb.PerformMigrations())
                {
                    Cmd.Pause();
                    return;
                }
            }
            catch (Exception ex)
            {
                Cmd.WriteException(ex);
                Cmd.Pause();
                throw;
            }

            var container = IoC.HaveYouAnyIoC(ConnectionString);
            var commands  = container
                            .Resolve <IEnumerable <ICliCommand> >()
                            .ToArray();
            var quitCommand = commands.OfType <QuitCommand>().Single();

            CliAppLoop.StartAppLoop(commands, quitCommand);
        }
예제 #2
0
        private static void Main(string[] args)
        {
            try
            {
                Cmd.WriteHeader("Initialising...");
                var upTheDb = new UpTheDb(ConnectionString);
                if (!upTheDb.DatabaseExists()) upTheDb.CreateDatabase();
                if (!upTheDb.PerformMigrations())
                {
                    Cmd.Pause();
                    return;
                }
            }
            catch (Exception ex)
            {
                Cmd.WriteException(ex);
                Cmd.Pause();
                throw;
            }

            var container = IoC.HaveYouAnyIoC(ConnectionString);
            var commands = container
                .Resolve<IEnumerable<ICliCommand>>()
                .ToArray();
            var quitCommand = commands.OfType<QuitCommand>().Single();

            CliAppLoop.StartAppLoop(commands, quitCommand);
        }