src/EntityFramework/Migrations/Design/CSharpMigrationCodeGenerator.cs
/// <summary>
/// Generates code for the given annotation value, which may be null. The default behavior is to use an
/// <see cref="AnnotationCodeGenerator"/> if one is registered, otherwise call ToString on the annotation value.
/// </summary>
/// <remarks>
/// Note that a <see cref="AnnotationCodeGenerator"/> can be registered to generate code for custom annotations
/// without the need to override the entire code generator.
/// </remarks>
/// <param name="name">The name of the annotation for which code is needed.</param>
/// <param name="annotation">The annotation value to generate.</param>
/// <param name="writer">The writer to which generated code should be written.</param>
Generates code for the given annotation value, which may be null. The default behavior is to use an
if one is registered, otherwise call ToString on the annotation value.
Generates code for the given annotation value which may be null . The default behavior is to use an if one is registered otherwise call ToString on the annotation value .
protected internal virtual void GenerateAnnotation(string name, object annotation, IndentedTextWriter writer)
        {
            Check.NotEmpty(name, "name");
            Check.NotNull(writer, "writer");
            if (annotation == null)
            {
                writer.Write("null");
                return;
            }
            Func<AnnotationCodeGenerator> annotationGenerator;
            if (AnnotationGenerators.TryGetValue(name, out annotationGenerator)
                && annotationGenerator != null)
            {
                annotationGenerator().Generate(name, annotation, writer);
            }
            else
            {
                writer.Write(Quote(annotation.ToString()));
            }
        }
protected internal virtual void GenerateAnnotation ( string name , object annotation , IndentedTextWriter writer ) { Check . NotEmpty ( name , " " ) ; Check . NotNull ( writer , " " ) ; if ( annotation == null ) { writer . Write ( " " ) ; return ; } Func < AnnotationCodeGenerator > annotationGenerator ; if ( AnnotationGenerators . TryGetValue ( name , out annotationGenerator ) && annotationGenerator != null ) { annotationGenerator ( ) . Generate ( name , annotation , writer ) ; } else { writer . Write ( Quote ( annotation . ToString ( ) ) ) ; } }
Generates code for the given annotation value, which may be null.
Generates code for the given annotation value which may be null .
name
string
The name of the annotation for which code is needed.
The name of the annotation for which code is needed .
annotation
object
The annotation value to generate.
The annotation value to generate .
writer
IndentedTextWriter
The writer to which generated code should be written.
The writer to which generated code should be written .
remarks
Note that a  can be registered to generate code for custom annotations
without the need to override the entire code generator.
Note that a can be registered to generate code for custom annotations without the need to override the entire code generator .