src/Shared/EntityFramework/Migrations/Design/VisualBasicMigrationCodeGenerator.cs
/// <summary>
/// Generates a namespace, using statements and class definition.
/// </summary>
/// <param name="namespace"> Namespace that code should be generated in. </param>
/// <param name="className"> Name of the class that should be generated. </param>
/// <param name="writer"> Text writer to add the generated code to. </param>
/// <param name="base"> Base class for the generated class. </param>
/// <param name="designer"> A value indicating if this class is being generated for a code-behind file. </param>
/// <param name="namespaces"> Namespaces for which Imports directives will be added. If null, then the namespaces returned from GetDefaultNamespaces will be used. </param>
Generates a namespace, using statements and class definition.
Generates a namespace using statements and class definition .
[SuppressMessage("Microsoft.Design", "CA1026:DefaultParametersShouldNotBeUsed")]
        [SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "namespace")]
        [SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "base")]
        protected virtual void WriteClassStart(
            string @namespace, string className, IndentedTextWriter writer, string @base, bool designer = false,
            IEnumerable<string> namespaces = null)
        {
            Check.NotNull(writer, "writer");
            Check.NotEmpty(className, "className");
            Check.NotEmpty(@base, "base");
            (namespaces ?? GetDefaultNamespaces(designer)).Each(n => writer.WriteLine("Imports " + n));
            if (!designer)
            {
                writer.WriteLine("Imports Microsoft.VisualBasic");
            }
            writer.WriteLine();
            if (!string.IsNullOrWhiteSpace(@namespace))
            {
                writer.Write("Namespace ");
                writer.WriteLine(@namespace);
                writer.Indent++;
            }
            WriteClassAttributes(writer, designer);
            writer.Write("Public ");
            if (designer)
            {
                writer.Write("NotInheritable ");
            }
            writer.Write("Partial Class ");
            writer.Write(className);
            writer.WriteLine();
            writer.Indent++;
            writer.WriteLine(@base);
            writer.Indent--;
            writer.WriteLine();
            writer.Indent++;
        }
[ SuppressMessage ( " " , " " ) ] [ SuppressMessage ( " " , " " , MessageId = " " ) ] [ SuppressMessage ( " " , " " , MessageId = " " ) ] protected virtual void WriteClassStart ( string @namespace , string className , IndentedTextWriter writer , string @base , bool designer = false , IEnumerable < string > namespaces = null ) { Check . NotNull ( writer , " " ) ; Check . NotEmpty ( className , " " ) ; Check . NotEmpty ( @base , " " ) ; ( namespaces ?? GetDefaultNamespaces ( designer ) ) . Each ( n => writer . WriteLine ( " " + n ) ) ; if ( ! designer ) { writer . WriteLine ( " " ) ; } writer . WriteLine ( ) ; if ( ! string . IsNullOrWhiteSpace ( @namespace ) ) { writer . Write ( " " ) ; writer . WriteLine ( @namespace ) ; writer . Indent ++ ; } WriteClassAttributes ( writer , designer ) ; writer . Write ( " " ) ; if ( designer ) { writer . Write ( " " ) ; } writer . Write ( " " ) ; writer . Write ( className ) ; writer . WriteLine ( ) ; writer . Indent ++ ; writer . WriteLine ( @base ) ; writer . Indent -- ; writer . WriteLine ( ) ; writer . Indent ++ ; }
Generates a namespace, using statements and class definition.
Generates a namespace using statements and class definition .
@namespace
string
className
string
Name of the class that should be generated.
Name of the class that should be generated .
writer
IndentedTextWriter
Text writer to add the generated code to.
Text writer to add the generated code to .
@base
string
designer
bool
A value indicating if this class is being generated for a code-behind file.
A value indicating if this class is being generated for a code - behind file .
namespaces
IEnumerable<string>
Namespaces for which Imports directives will be added. If null, then the namespaces returned from GetDefaultNamespaces will be used.
Namespaces for which Imports directives will be added . If null then the namespaces returned from GetDefaultNamespaces will be used .
namespace
Namespace that code should be generated in.
Namespace that code should be generated in .
base
Base class for the generated class.
Base class for the generated class .