private static MigrationScriptCollection CompileMigrationScripts(IDbPlatform dbPlatform, INativeSqlResourceProvider nativeSqlResourceProvider,
     TextReader migrationDefinition, MigrationMode migrationMode)
 {
     MigrationScriptCompiler migrationScriptCompiler = new MigrationScriptCompiler(dbPlatform, nativeSqlResourceProvider, migrationMode);
     return migrationScriptCompiler.CompileMigrationScripts(migrationDefinition);
 }
        /// <summary>
        /// Executes the current command.
        /// </summary>
        /// <param name="parameters"></param>
        protected override void InternalExecute(MigrationParameters parameters)
        {
            var migrationVersionInfoManager = ServiceProvider.GetService<IMigrationVersionInfoManager>();
            var dbPlatform = ServiceProvider.GetService<IDbPlatform>();

            var currentMigrationVersion = MigrationVersionInfoManagerUtil.GetCurrentMigrationVersion(
                   migrationVersionInfoManager,
                   dbPlatform, parameters.ConnectionString);

            var registeredMigrationVersions = MigrationVersionInfoManagerUtil.GetRegisteredMigrationVersions(
                   migrationVersionInfoManager,
                   dbPlatform, parameters.ConnectionString);

            if(currentMigrationVersion == 0)
            {
                using(new ConsoleStylingScope(ConsoleColor.Yellow))
                    System.Console.WriteLine(Environment.NewLine + Resources.DatabaseIsNotVersioned);

                return;
            } // if

            System.Console.WriteLine();
            using(new ConsoleStylingScope(ConsoleColor.Green))
            {
                System.Console.WriteLine(Resources.CurrentDatabaseVersionInfo, currentMigrationVersion);

                if(registeredMigrationVersions.Count == 0)
                    return;

                System.Console.WriteLine(Resources.RegisteredDatabaseVersionsInfo);
                foreach(var registeredVersion in registeredMigrationVersions)
                    System.Console.WriteLine(Resources.RegisteredDatabaseVersionInfo, registeredVersion);
            } // using

            if(string.IsNullOrEmpty(parameters.MdlFileName)) return;

            var msc = new MigrationScriptCompiler(dbPlatform, new FileSystemNativeSqlResourceProvider(Directory.GetCurrentDirectory()), MigrationMode.Upgrade);
            var scripts = msc.CompileMigrationScripts(File.OpenText(parameters.MdlFileName));

            var first = true;

            using(new ConsoleStylingScope(ConsoleColor.Yellow))
                foreach(var s in scripts)
                {
                    if(registeredMigrationVersions.Contains(s.MigrationVersion)) continue;
                    
                    if(first)
                    {
                        System.Console.WriteLine(Resources.UnregisteredVersion);
                        first = false;
                    } // if

                    System.Console.WriteLine(@"    " + s.MigrationVersion);
                } // foreach
        }