GeneratorAttribute Class

Identifies the designer for the data generator.

Namespace:  Microsoft.Data.Schema.DataGenerator
Assembly:  Microsoft.Data.Schema (in Microsoft.Data.Schema.dll)

Syntax

'Declaration
<AttributeUsageAttribute(AttributeTargets.Class, AllowMultiple := False, Inherited := True)> _
<CLSCompliantAttribute(True)> _
Public NotInheritable Class GeneratorAttribute _
    Inherits Attribute
'Usage
Dim instance As GeneratorAttribute
[AttributeUsageAttribute(AttributeTargets.Class, AllowMultiple = false, Inherited = true)]
[CLSCompliantAttribute(true)]
public sealed class GeneratorAttribute : Attribute
[AttributeUsageAttribute(AttributeTargets::Class, AllowMultiple = false, Inherited = true)]
[CLSCompliantAttribute(true)]
public ref class GeneratorAttribute sealed : public Attribute
public final class GeneratorAttribute extends Attribute

Remarks

The Generator abstract base class has the GeneratorAttribute and specifies the DefaultGeneratorDesigner.

You should use the GeneratorAttribute in the following case:

  • You want a data generator to use a custom designer.

You should not use the GeneratorAttribute in the following cases:

  • Your data generator class inherits from Generator and you want to use the DefaultGeneratorDesigner.

  • Your data generator class inherits from another data generator class that is already decorated with GeneratorAttribute and you are satisfied with the designer already specified.

Examples

The following example demonstrates how to decorate a class with the GeneratorAttribute. In this example, the data generator is associated with a custom designer that is named CustomDesignerType.

[Generator(typeof(CustomDesignerType))]
public class TestGenerator:Generator
{
}
<Generator(GetType(CustomDesignerType))> _
Public Class TestGenerator
    Inherits Generator

End Class

Inheritance Hierarchy

System.Object
  System.Attribute
    Microsoft.Data.Schema.DataGenerator.GeneratorAttribute

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

GeneratorAttribute Members

Microsoft.Data.Schema.DataGenerator Namespace

Generator

IGenerator

GeneratorInit

Other Resources

How to: Create Custom Data Generators