/// <summary>
        /// Generates FluentMigration C# files based on the views found in <see cref="schemaDumper"/>
        /// </summary>
        /// <param name="context">Defines how, what and where the migrations will be generated</param>
        /// <param name="schemaDumper">The platform specific schema dumper instance to get view information from</param>
        public void GenerateMigrations(SchemaMigrationContext context, ISchemaDumper schemaDumper)
        {
            _announcer.Say("Reading views");
             var defs = schemaDumper.ReadViews();

             SetupMigrationsDirectory(context);

             //TODO: Think about adding custom sort order for view definitions as there may be
             // dependancies between views.
             // if ( context.CustomViewSorter != null )
             //   defs = context.CustomViewSorter(defs);

             var migrations = 0;
             foreach (var view in defs)
             {
            if ( context.ExcludeViews.Contains(view.Name))
            {
               _announcer.Say("Excluding view " + view.Name);
               continue;
            }

            if (context.IncludeViews.Count != 0 && !context.IncludeViews.Contains(view.Name)) continue;

            migrations++;

            var migrationsFolder = Path.Combine(context.WorkingDirectory, context.MigrationsDirectory);
            var csFilename = Path.Combine(migrationsFolder, context.MigrationViewClassNamer(context.MigrationIndex + migrations, view) + ".cs");

            _announcer.Say("Creating migration " + Path.GetFileName(csFilename));
            using (var writer = new StreamWriter(csFilename))
            {
               WriteToStream(context, view, context.MigrationIndex + migrations, writer);
            }
             }

             context.MigrationIndex += migrations;
        }
 /// <summary>
 /// Writes the Migration Up() and Down()
 /// </summary>
 /// <param name="context">The context that controls how the column should be generated</param>
 /// <param name="view">the view to generate the migration for</param>
 /// <param name="migration">The migration index to apply</param>
 /// <param name="output">The output stream to append the C# code to</param>
 private void WriteToStream(SchemaMigrationContext context, ViewDefinition view, int migration, StreamWriter output)
 {
     WriteMigration(output, context, migration
     , () => context.MigrationViewClassNamer(migration, view)
     , () => WriteView(context, view, output)
     , () => WriteDeleteView(context, view, output));
 }