src/Shared/EntityFramework/Migrations/Design/VisualBasicMigrationCodeGenerator.cs
/// <summary>
/// Generates code for to re-create the given dictionary of annotations for use when passing
/// these annotations as a parameter of a <see cref="DbMigration"/>. call.
/// </summary>
/// <param name="annotations">The annotations to generate.</param>
/// <param name="writer">The writer to which generated code should be written.</param>
Generates code for to re-create the given dictionary of annotations for use when passing
these annotations as a parameter of a . call.
Generates code for to re - create the given dictionary of annotations for use when passing these annotations as a parameter of a . call .
protected internal virtual void GenerateAnnotations(IDictionary<string, AnnotationValues> annotations, IndentedTextWriter writer)
        {
            Check.NotNull(annotations, "annotations");
            Check.NotNull(writer, "writer");
            writer.WriteLine("New Dictionary(Of String, AnnotationValues)() From _");
            writer.WriteLine("{");
            writer.Indent++;
            if (annotations != null)
            {
                var names = annotations.Keys.OrderBy(k => k).ToArray();
                for (var i = 0; i < names.Length; i++)
                {
                    writer.WriteLine("{");
                    writer.Indent++;
                    writer.WriteLine(Quote(names[i]) + ",");
                    writer.Write("New AnnotationValues(oldValue := ");
                    GenerateAnnotation(names[i], annotations[names[i]].OldValue, writer);
                    writer.Write(", newValue := ");
                    GenerateAnnotation(names[i], annotations[names[i]].NewValue, writer);
                    writer.WriteLine(")");
                    writer.Indent--;
                    writer.WriteLine(i < names.Length - 1 ? " }," : " }");
                }
            }
            writer.Indent--;
            writer.Write("}");
        }
protected internal virtual void GenerateAnnotations ( IDictionary < string , AnnotationValues > annotations , IndentedTextWriter writer ) { Check . NotNull ( annotations , " " ) ; Check . NotNull ( writer , " " ) ; writer . WriteLine ( " " ) ; writer . WriteLine ( " " ) ; writer . Indent ++ ; if ( annotations != null ) { var names = annotations . Keys . OrderBy ( k => k ) . ToArray ( ) ; for ( var i = 0 ; i < names . Length ; i ++ ) { writer . WriteLine ( " " ) ; writer . Indent ++ ; writer . WriteLine ( Quote ( names [ i ] ) + " " ) ; writer . Write ( " " ) ; GenerateAnnotation ( names [ i ] , annotations [ names [ i ] ] . OldValue , writer ) ; writer . Write ( " " ) ; GenerateAnnotation ( names [ i ] , annotations [ names [ i ] ] . NewValue , writer ) ; writer . WriteLine ( " " ) ; writer . Indent -- ; writer . WriteLine ( i < names . Length - 1 ? " " : " " ) ; } } writer . Indent -- ; writer . Write ( " " ) ; }
Generates code for to re-create the given dictionary of annotations for use when passing
these annotations as a parameter of a .
Generates code for to re - create the given dictionary of annotations for use when passing these annotations as a parameter of a .
annotations
IDictionary<string, AnnotationValues>
The annotations to generate.
The annotations to generate .
writer
IndentedTextWriter
The writer to which generated code should be written.
The writer to which generated code should be written .