Rules
How SeedPacket knows which data to create
Overview
The Rules collection that governs data generation is highly customizable. You can easily add your own rules, remove rules, replace a Rule with your own version, or even wipe out all the Rules and start over. Consult the source code on GitHub for examples to base your own custom Rules on.
As the collection is public, it is alway possible to output a list of all the currently loaded rules. Each rule displays name, description (if available), type it matches, and property name it matches (if specified). This list is the default for the MultiDataSource. Keep in mind that order does matter as rules are always applied last to first.
Debugging is turned ON by default and writes useful information to the debug Output window in Visual Studio. For each type that is run, the name of each public property, property type, and the name of the Rule that matched it is shown.
Basic Rules Set
This set of deterministic rules is a default option for the MultiGenerator, covering basic data types. For strings, the "String" rule returns the property name with the row number appended. Nullable types follow the same pattern, with a 1 in 6 chance of being null.
Name | Description | If Type Is... | If Property Name Is... |
---|---|---|---|
String | Returns propertyName + RowNumber. | System.String | Any |
Bool | Returns alternating true & false. | System.Boolean | Any |
Int | Returns RowNumber | System.Int32 | Any |
Long | Returns RowNumber | System.Int64 | Any |
Double | Returns RowNumber | System.Double | Any |
Decimal | Returns RowNumber | System.Decimal | Any |
DateTime | Returns BaseDateTime | System.DateTime | Any |
Guid | Returns a Guid | System.Guid | Any |
Bool? | Returns alternating true & false (1 in 6 NULL) | System.Nullable`1 [System.Boolean] |
Any |
Int? | Returns RowNumber (1 in 6 NULL) | System.Nullable`1 [System.Int32] |
Any |
Long? | Returns RowNumber (1 in 6 NULL) | System.Nullable`1 [System.Int64] |
Any |
Double? | Returns RowNumber (1 in 6 NULL) | System.Nullable`1 [System.Double] |
Any |
Decimal? | Returns RowNumber (1 in 6 NULL) | System.Nullable`1 [System.Decimal] |
Any |
DateTime? | Returns BaseDateTime (1 in 6 NULL) | System.Nullable`1 [System.DateTime] |
Any |
Common Rules Set
The Common Rules Set loads the Basic Rules Set and then these additional, more specific rules to simulate common scenarios like names, address information, usernames, etc.
Name | Description | If Type Is... | If Propery Name Matches... |
---|---|---|---|
String | Random string from data or default | System.String | Any |
FirstName | Random firstName | System.String | %firstname%,%givenname% |
LastName | Random lastname | System.String | %lastname%,%surname% |
FullName | Random fullName | System.String | %fullname% |
User | Random username | System.String | %user% |
Address | Random address | System.String | %address% |
City | Random city | System.String | %city% |
County | Random county | System.String | %county% |
State | Random state | System.String | %state% |
StateName | Random state name | System.String | %statename% |
Country | Random country | System.String | %country% |
Zip | Random zip | System.String | %zip% |
Fee/Tax | Random fee/tax | System.Decimal | %fee%,%tax% |
Cost/Price | Random cost/price | System.Decimal | %cost%,%price%,%worth% |
Company/Business | Random company/business | System.String | %company%,%business%,%account% |
Product/Item | Random product/item | System.String | %product%,%item% |
Random email | System.String | %email% | |
RowRandomNumber | Random number | System.Int32 | %random% |
Phone/Cell/Mobile/Fax | Random phone/cell/mobile/fax | System.String | %phone%,%cell%,%mobile%,%fax% |
DateTime | Random DateTime base +/- 2yr by hour | System.DateTime | Any |
DateTime? | Random DateTime? base +/- 2yr by hour | System.Nullable`1 [System.DateTime] |
Any |
Text/Note/Lorem | Random lorem text paragraph | System.String | %text%,%note%,%lorem% |
RandomBodyCopy | Random copy list | System.Collections.Generic .IList`1[System.String] |
%body%,%copy% |