コード例 #1
0
        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>();
        }
コード例 #2
0
ファイル: Scripter.cs プロジェクト: nick-randal/UsefulCSharp
 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;
 }
コード例 #3
0
        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();
        }
コード例 #4
0
ファイル: Runner.cs プロジェクト: nick-randal/UsefulCSharp
        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());
        }
コード例 #5
0
        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);
        }
コード例 #6
0
ファイル: Program.cs プロジェクト: nick-randal/UsefulCSharp
        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));
        }
コード例 #7
0
ファイル: Program.cs プロジェクト: gungledeezer/UsefulCSharp
        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));
        }
コード例 #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);
            }
        }
コード例 #9
0
        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();
        }
コード例 #10
0
        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>();
        }
コード例 #11
0
ファイル: Program.cs プロジェクト: nick-randal/UsefulCSharp
        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);
            }
        }