src/EntityFramework/Migrations/Design/CSharpMigrationCodeGenerator.cs
/// <summary>
/// Generates code to perform a <see cref="DropTableOperation" />.
/// </summary>
/// <param name="dropTableOperation"> The operation to generate code for. </param>
/// <param name="writer"> Text writer to add the generated code to. </param>
Generates code to perform a .
Generates code to perform a .
protected virtual void Generate(DropTableOperation dropTableOperation, IndentedTextWriter writer)
        {
            Check.NotNull(dropTableOperation, "dropTableOperation");
            Check.NotNull(writer, "writer");
            writer.Write("DropTable(");
            writer.Write(Quote(dropTableOperation.Name));
            if (dropTableOperation.RemovedAnnotations.Any())
            {
                writer.Indent++;
                writer.WriteLine(",");
                writer.Write("removedAnnotations: ");
                GenerateAnnotations(dropTableOperation.RemovedAnnotations, writer);
                writer.Indent--;
            }
            var columns = dropTableOperation.RemovedColumnAnnotations;
            if (columns.Any())
            {
                writer.Indent++;
                writer.WriteLine(",");
                writer.Write("removedColumnAnnotations: ");
                writer.WriteLine("new Dictionary<string, IDictionary<string, object>>");
                writer.WriteLine("{");
                writer.Indent++;
                foreach (var columnName in columns.Keys.OrderBy(k => k))
                {
                    writer.WriteLine("{");
                    writer.Indent++;
                    writer.WriteLine(Quote(columnName) + ",");
                    GenerateAnnotations(columns[columnName], writer);
                    writer.WriteLine();
                    writer.Indent--;
                    writer.WriteLine("},");
                }
                writer.Indent--;
                writer.Write("}");
                writer.Indent--;
            }
            writer.WriteLine(");");
        }
protected virtual void Generate ( DropTableOperation dropTableOperation , IndentedTextWriter writer ) { Check . NotNull ( dropTableOperation , " " ) ; Check . NotNull ( writer , " " ) ; writer . Write ( " " ) ; writer . Write ( Quote ( dropTableOperation . Name ) ) ; if ( dropTableOperation . RemovedAnnotations . Any ( ) ) { writer . Indent ++ ; writer . WriteLine ( " " ) ; writer . Write ( " " ) ; GenerateAnnotations ( dropTableOperation . RemovedAnnotations , writer ) ; writer . Indent -- ; } var columns = dropTableOperation . RemovedColumnAnnotations ; if ( columns . Any ( ) ) { writer . Indent ++ ; writer . WriteLine ( " " ) ; writer . Write ( " " ) ; writer . WriteLine ( " " ) ; writer . WriteLine ( " " ) ; writer . Indent ++ ; foreach ( var columnName in columns . Keys . OrderBy ( k => k ) ) { writer . WriteLine ( " " ) ; writer . Indent ++ ; writer . WriteLine ( Quote ( columnName ) + " " ) ; GenerateAnnotations ( columns [ columnName ] , writer ) ; writer . WriteLine ( ) ; writer . Indent -- ; writer . WriteLine ( " " ) ; } writer . Indent -- ; writer . Write ( " " ) ; writer . Indent -- ; } writer . WriteLine ( " " ) ; }
Generates code to perform a .
Generates code to perform a .
dropTableOperation
DropTableOperation
The operation to generate code for.
The operation to generate code for .
writer
IndentedTextWriter
Text writer to add the generated code to.
Text writer to add the generated code to .