dbForge Studio for SQL Server allows you to create, save, and use your own custom data generators that would better meet your needs, instead of customizing the predefined generators over and over again. You can add one or more custom generators to the existing categories: Business, Health, Location, IT, Payment, Personal, and Product.
You can create a custom generator in two ways - on the basis of a template or from scratch.
dbForge Studio for SQL Server is supplied with a wide collection of generator templates that can be easily used for creation of your own data generators.
To create a custom generator based on a template:
1. Open the Templates folder in
C:\Users\Public\Public Documents\Devart\dbForge Studio for SQL Server\Data Generators\Templates
.
Note
The default location to store custom data generation settings is
C:\Users\Public\Public Documents\Devart\dbForge Studio for SQL Server\Data Generators\Templates
, and while it is not possible to change it, you can specify a custom location of .dgen files by modifying the registry at:
Computer\HKEY_CURRENT_USER\Software\Devart\dbForge Studio for SQL Server\Folders
.
2. Open a required template in an editor.
3. Modify the selected generator according to your needs. For more information, see the Explanation of tags and Mapping rules sections of this topic.
4. Put the generator file into the Data Generators folder.
5. Start (or restart) dbForge Studio.
The following example is based on the Regular Expression Generator, which is most frequently customized.
1. Open the Data Generators folder in
C:\Users\Public\Public\Documents\Devart\dbForge Studio for SQL Server\Data Generators
.
Note
The default location to store custom data generation settings is
C:\Users\Public\Public\Documents\Devart\dbForge Studio for SQL Server\Data Generators
, and while it is not possible to change it, you can specify a custom location of .dgen files by modifying the registry at:
Computer\HKEY_CURRENT_USER\Software\Devart\dbForge Studio for SQL Server\Folders
.
2. In this folder, create an .xml file or copy and paste one of the existing files.
3. Edit the file to include the following code.
4. Save the .xml file.
5. Start (or restart) Data Generator.
Tag | Description |
---|---|
<Category></Category> |
the category a custom generator is added to |
<Name></Name> |
the name of a generator being added |
<ShortName></ShortName> |
the name of a generator that will be displayed in the Preview window |
<Description></Description> |
the description of a generator |
<Type></Type> |
the type of a basic generator on which a created generator is based |
<Language></Language> |
a language to assign a generator depending on a user’s locale |
<Matches></Matches> |
auto-mapping rules |
<ColumnTypes></ColumnTypes> |
data types for which a generator will be available |
<Options></Options> |
contains other tags for configuring a generator, depending on a generator type |
Value | Description |
---|---|
table="" |
a name of the matched table(s) |
column="" |
a name of the matched column(s) |
* |
any number of characters |
^ |
strict beginning of a name, i.e. "^Test.*" means that the beginning of the name must be "Test" , followed by any characters (the valid table names may be the following: test, testing, Test123, etc.) |
$ |
strict end of a name, i.e. ".*Test$" means that the end of the name must be "Test" , preceded by any characters (the valid table names may be the following: test, myTest, 123test, etc.) |
| |
"or" listing |
priority="n" |
mapping priority - the rule according to which a generator is automatically assigned to a column (the higher the number, the higher the priority; for the custom generators it should be higher than 4 because the default data type generators have a priority range of between 1 and 4) |
minlen="n" |
the minimum permissible length of a column (the parameter is ignored for varchar(max), nvarchar(max), text, ntext, image, and varbinary(max)) |
maxlen="n" |
the maximum length of a column (this parameter is optional; the parameter is ignored for varchar(max), nvarchar(max), text, ntext, image, and varbinary(max)) |