コード例 #1
0
ファイル: Program.cs プロジェクト: nick-randal/UsefulCSharp
        private static void ConfigureScriptingSources(AppOptions options, Scripter scripter)
        {
            if (options.ScriptFunctions)
            {
                scripter.AddSources(
                    new ScriptingSource("Functions", (srvr, db) => srvr.GetUserDefinedFunctions(db))
                );
            }

            if (options.ScriptStoredProcedures)
            {
                scripter.AddSources(
                    new ScriptingSource("Sprocs", (srvr, db) => srvr.GetStoredProcedures(db))
                );
            }

            if (options.ScriptTables)
            {
                scripter.AddSources(
                    new ScriptingSource("Tables", (srvr, db) => srvr.GetTables(db))
                );
            }

            if (options.ScriptViews)
            {
                scripter.AddSources(
                    new ScriptingSource("Views", (srvr, db) => srvr.GetViews(db))
                );
            }
        }
コード例 #2
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));
        }