Exemplo n.º 1
0
        private static void Main(string[] args)
        {
            if (args.Length != 4 && args.Length != 6)
            {
                InvalidArguments();
                return;
            }

            ConnectionSettings settings = null;

            var deployer = new ConsoleDatabaseDeployer();

            var    action          = (RequestedDatabaseAction)Enum.Parse(typeof(RequestedDatabaseAction), args[0]);
            string server          = args[1];
            string database        = args[2];
            string scriptDirectory = args[3];

            if (args.Length == 4)
            {
                settings = new ConnectionSettings(server, database, true, null, null);
            }

            else if (args.Length == 6)
            {
                string username = args[4];
                string password = args[5];

                settings = new ConnectionSettings(server, database, false, username, password);
            }

            if (deployer.UpdateDatabase(settings, scriptDirectory, action))
            {
                return;
            }

            Environment.ExitCode = 1;
        }
Exemplo n.º 2
0
        private static void Main(string[] args)
        {
            if (args.Length != 4 && args.Length != 6)
            {
                InvalidArguments();
                return;
            }

            ConnectionSettings settings = null;

            var deployer = new ConsoleDatabaseDeployer();

            var action = (RequestedDatabaseAction)Enum.Parse(typeof(RequestedDatabaseAction), args[0]);
            string server = args[1];
            string database = args[2];
            string scriptDirectory = args[3];
            
            if (args.Length == 4)
            {
                settings = new ConnectionSettings(server, database, true, null, null);
            }

            else if (args.Length == 6)
            {
                string username = args[4];
                string password = args[5];

                settings = new ConnectionSettings(server, database, false, username, password);
            }

            if (deployer.UpdateDatabase(settings, scriptDirectory, action))
            {
                return;
            }    

            Environment.ExitCode = 1;
        }