public ProjectLoader(string projectPath, IScriptParserConsumer scriptParser, IScriptCheckerConsumer scriptChecker = null, ILoggerSync logger = null)
        {
            _logger = logger ?? new NullLogger();

            ProjectPath = projectPath;
            ScriptParser = scriptParser;
            ScriptChecker = scriptChecker;
            _allScripts = new List<SourceScript>();
        }
Exemple #2
0
 public Scripter(IServer server, IScriptFileManager scriptFileManager, ILogger logger, IScriptFormatter formatter = null)
 {
     _server = server;
     _scriptFileManager = scriptFileManager;
     _includeTheseDatabases = new List<string>();
     _excludeTheseDatabases = new List<string>();
     _sources = new List<ScriptingSource>();
     _formatter = formatter ?? new ScriptFormatter();
     _logger = logger;
 }
        public SqlServerDeployer(IScriptDeployerConfig config, IProject project, ISqlConnectionManager connectionManager, ILoggerSync logger)
            : base(config, project)
        {
            if (project == null)
                throw new ArgumentNullException("project");
            if (connectionManager == null)
                throw new ArgumentNullException("connectionManager");

            _connectionManager = connectionManager;
            _logger = logger ?? new NullLogger();
            _patternLookup = new CatalogPatternLookup();
        }
Exemple #4
0
        public Runner(IRunnerSettings settings, ILogger logger = null)
        {
            if (settings == null)
                throw new ArgumentNullException("settings");

            _settings = settings;
            _logger = logger ?? new NullLogger();
            var configPath = Path.Combine(Directory.GetCurrentDirectory(), "config.json");

            using (var reader = new FileInfo(configPath).OpenText())
                _config = JsonConvert.DeserializeObject<ScriptDeployerConfig>(reader.ReadToEnd());
        }
        public ScriptFileDeployer(IScriptDeployerConfig config, IProject project, ISqlConnectionManager connectionManager, ILogger logger)
            : base(config, project)
        {
            if (project == null)
                throw new ArgumentNullException("project");

            _connectionManager = connectionManager;
            _logger = logger ?? new NullLogger();
            _patternLookup = new CatalogPatternLookup();

            var fileName = string.Format("{0}_{1}_v{2}.sql", connectionManager.Server, project.Configuration.Project, project.Configuration.Version.Replace('.', '-'));
            var path = Path.Combine("G:\\", fileName);
            _writer = new StreamWriter(File.Create(path, 16384, FileOptions.Asynchronous));

            _writer.WriteLine("-- Generated {0} on {1} by {2}", DateTime.Now, Environment.MachineName, Environment.UserName);
        }
Exemple #6
0
        private static void LogHeader(ILoggerSync logger, AppOptions options)
        {
            logger.PostEntry("SQL Scripting Application");
            logger.PostEntry(typeof (Program).Assembly.GetName().Version.ToString());

            var lines = new List<string>
            {
                string.Concat("Server           ", options.Server),
                string.Concat("Output Folder    ", options.OutputFolder),
                string.Concat("Log Folder       ", options.LogFolder),
                string.Concat("Included DBs     ", string.Join(", ", options.IncludeDatabases)),
                string.Concat("Excluded DBs     ", string.Join(", ", options.ExcludeDatabases)),
                string.Concat("Script UDFs      ", options.ScriptFunctions),
                string.Concat("Script Sprocs    ", options.ScriptStoredProcedures),
                string.Concat("Script Tables    ", options.ScriptTables),
                string.Concat("Script Views     ", options.ScriptViews),
            };

            lines.ForEach(l => logger.PostEntryNoTimestamp(l));
        }
Exemple #7
0
        private static void LogHeader(ILoggerSync logger, AppOptions options)
        {
            logger.PostEntry("SQL Scripting Application");
            logger.PostEntry(typeof(Program).Assembly.GetName().Version.ToString());

            var lines = new List <string>
            {
                string.Concat("Server           ", options.Server),
                string.Concat("Output Folder    ", options.OutputFolder),
                string.Concat("Log Folder       ", options.LogFolder),
                string.Concat("Included DBs     ", string.Join(", ", options.IncludeDatabases)),
                string.Concat("Excluded DBs     ", string.Join(", ", options.ExcludeDatabases)),
                string.Concat("Script UDFs      ", options.ScriptFunctions),
                string.Concat("Script Sprocs    ", options.ScriptStoredProcedures),
                string.Concat("Script Tables    ", options.ScriptTables),
                string.Concat("Script Views     ", options.ScriptViews),
            };

            lines.ForEach(l => logger.PostEntryNoTimestamp(l));
        }
Exemple #8
0
        private static void SendLogFilePathToExchange(ILoggerSync logger, IRollingFileLogSink fileLogSink, AppOptions options)
        {
            try
            {
                if (string.IsNullOrWhiteSpace(options.ExchangePath))
                {
                    logger.PostEntry("Exchange -e option not set, skipping.");
                    return;
                }

                logger.PostEntry("Attempting connection to UI Host '" + SharedConst.LogExchangeNetPipe + "'.");

                var endPoint    = new EndpointAddress(SharedConst.LogExchangeNetPipe);
                var pipeFactory = new ChannelFactory <ILogExchange>(new NetNamedPipeBinding(), endPoint);
                var logExchange = pipeFactory.CreateChannel();

                logExchange.ReportLogFilePath(fileLogSink.CurrentLogFilePath ?? "Path not found.");
            }
            catch (EndpointNotFoundException ex)
            {
                logger.PostException(ex);
            }
        }
        public SqlServerDeployer(IScriptDeployerConfig config, IProject project, ISqlConnectionManager connectionManager, ILoggerSync logger)
            : base(config, project)
        {
            if (project == null)
            {
                throw new ArgumentNullException("project");
            }
            if (connectionManager == null)
            {
                throw new ArgumentNullException("connectionManager");
            }

            _connectionManager = connectionManager;
            _logger            = logger ?? new NullLogger();
            _patternLookup     = new CatalogPatternLookup();
        }
        public ProjectLoader(string projectPath, IScriptParserConsumer scriptParser, IScriptCheckerConsumer scriptChecker = null, ILoggerSync logger = null)
        {
            _logger = logger ?? new NullLogger();

            ProjectPath   = projectPath;
            ScriptParser  = scriptParser;
            ScriptChecker = scriptChecker;
            _allScripts   = new List <SourceScript>();
        }
Exemple #11
0
        private static void SendLogFilePathToExchange(ILoggerSync logger, IRollingFileLogSink fileLogSink, AppOptions options)
        {
            try
            {
                if (string.IsNullOrWhiteSpace(options.ExchangePath))
                {
                    logger.PostEntry("Exchange -e option not set, skipping.");
                    return;
                }

                logger.PostEntry("Attempting connection to UI Host '" + SharedConst.LogExchangeNetPipe + "'.");

                var endPoint = new EndpointAddress(SharedConst.LogExchangeNetPipe);
                var pipeFactory = new ChannelFactory<ILogExchange>(new NetNamedPipeBinding(), endPoint);
                var logExchange = pipeFactory.CreateChannel();

                logExchange.ReportLogFilePath(fileLogSink.CurrentLogFilePath ?? "Path not found.");
            }
            catch(EndpointNotFoundException ex)
            {
                logger.PostException(ex);
            }
        }