Share via


Walkthrough: Registering a Custom Data Generator

Custom data generators are code modules that you create to generate data in Visual Studio Team System Database Edition. After you create a custom generator, you must register it on your computer. You can either register your generator manually, or create a deployment project to register it automatically. In this walkthrough, you manually register a custom data generator.

Prerequisites

To complete this walkthrough, you need the following:

Registering the Generator

After you create a generator, you must register it with Visual Studio to integrate your generator with Data Generator.

To register a generator

  1. Open the solution that you completed in Walkthrough: Creating a Custom Data Generator.

  2. On the View menu, click Other Windows,and then click Command Window to open the Command window.

  3. In the Command window, type the following code. For FilePath, substitute the path and file name of your compiled .dll file. Include the quotation marks around the path and file name.

    Note

    By default, the path of your compiled .dll file is YourSolutionPath\bin\Debug or YourSolutionPath\bin\Release.

    ? System.Reflection.Assembly.LoadFrom("FilePath").FullName
    
    ? System.Reflection.Assembly.LoadFrom(@"FilePath").FullName
    

    Note

    You can also use System.Reflection.Assembly.LoadFile("FilePath").FullName for either Visual Basic or Visual C#.

  4. Press ENTER.

  5. Copy the resultant line to the Clipboard. The line should resemble the following:

    "TestGenerator, Version=1.0.0.0, Culture=neutral, PublicKeyToken= TokenKey "
    
  6. Open a plain-text editor, such as Notepad.

  7. Provide the following information, specifying your own assembly name, public key token, and extension type, by using the information that you copied in the previous step:

    <?xml version="1.0" encoding="utf-8" ?> 
      <extensions assembly="GeneratorAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=TokenKey" version="1" xmlns="urn:Microsoft.VisualStudio.TeamSystem.Data.Extensions" xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:Microsoft.VisualStudio.TeamSystem.Data.Extensions Microsoft.VisualStudio.TeamSystem.Data.Extensions.xsd">
      <extension type="GeneratorNamespace.GeneratorClassName" enabled="true" /> 
      </extensions>
    

    Note

    The extension type is of the form "namespace.classname". The assembly name does not contain the ".dll" extension.

  8. Save the file by using the following information:

    File name

    TestGenerator.Extensions.xml

    Location

    [Program Files]\Microsoft Visual Studio 9.0\DBPro

  9. Copy your compiled .dll file to the following location:

    Location

    [ProgramFiles]\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies

  10. Close Visual Studio.

  11. Re-open Visual Studio.

    Your generator is registered and ready to use.

Security

For more information, see Security of Data Generators.

Next Steps

Now that you have registered the custom data generator, you can create a data generation plan and test it. You can also build a deployment project to register the data generator automatically.

See Also

Tasks

How to: Register Custom Data Generators

Concepts

An Overview of Data Generator Extensibility

Reference

Microsoft.VisualStudio.TeamSystem.Data.DataGenerator

Other Resources

Creating Custom Data Generators