Codegeneration Command
Generates .cs, .ts and metadata.xml model files for Dataverse.
Optional Parameters
TargetDirectory
Full path to the directory where the generated model classes will be saved. Default is current folder.
--folder
-f
Define an alternate name for the model folder. Default is Model
.
--config
-c
Full or relative path to the config file, e.g. 'C:\temp\config.json'. Default is config.json
.
Examples
Generate model using default parameters
Switch profile and generate model in certain sub folder
Model configuration file
The model generation supports different kinds of tasks to execute:
DotNet
TypeScript
MetaData
DotNet + MetaData
DotNet + TypeScript + MetaData
For the sake of clarity, the chapters on configuration file parameters are separated by target. In addition to the general parameters, target-specific parameters can also be used. Use this handy list to jump directly to the chapter you need:
As an introduction to the config topic, please have a look at the examples listed below.
General parameters
Required parameters
These parameters should always be included. Otherwise the code generation will fail or at least will show warnings.
Parameter | Value type | Description |
---|---|---|
Entities | string[] | List of all tables for which model content should be created |
Actions | string[] | List of all actions for which model content should be created |
CustomAPIs | string[] | List of all custom apis for which model content should be created |
Additional content
If you want to generate additional model content on top of the default stuff, use these parameters.
Parameter | Value type | Default | Description |
---|---|---|---|
AdditionalSdkMessages | string[] |
| List of all additional sdk messages for which model content should be created |
GlobalOptionSets | string[] |
| Generate code for these global option sets only |
Filters
To reduce the amount classes or solution components to get generated code for, use these parameters.
Parameter | Value type | Default | Description |
---|---|---|---|
EntityMask | string |
| Additional to the list of entities you can create a mask to get all entities which fit example: "new_*" would create models for all entities which start with new_ |
SdkMessageFilters | string[] |
| Generate code for these sdk messages only |
Solutions | string[] |
| List all solutions for which classes should be generated. (TypeScript: see |
SuppressOptions | bool |
| Deactivate creation of OptionSetValues |
SuppressSdkMessages | bool |
| Deactivate creation of SdkMessages (Create, Update, Delta, etc..) |
Output management
To define how the output should look like or for which targets you want generated code, use the following parameters.
Parameter | Value type | Default | Description |
---|---|---|---|
Hints | bool |
| Show hints for config improvements or deprecated parameter usage on console. |
SuppressDotNet | bool |
| Deactivate creation of DotNet files (.cs) |
SuppressMetaData | bool |
| Deactivate creation of MetaData files (.xml) |
SuppressTypeScript | bool |
| Deactivate creation of TypeScript files (.ts) |
UseBaseLanguage | bool |
| Generated summaries and optionset labels in system base language |
DotNet specific parameters
Filters
Parameter | Value type | Default | Description |
---|---|---|---|
SuppressActions | bool |
| Deactivate creation of Actions |
SuppressAlternateKeys | bool |
| |
SuppressContext | bool |
| Deactivate creation of the Context File |
SuppressEntityTypeCode | bool |
| |
SuppressLogicalNames | bool |
| Deactivate creation of Logical Names |
SuppressNavigationProperties | bool |
| Deactivate creation of the navigation properties |
SuppressRelations | bool |
| Deactivate creation of all Relation Names |
Output management
Parameter | Value type | Default | Description |
---|---|---|---|
EditableReadOnlyProperties | bool |
| Make generated readonly properties editable |
NameSpace | string |
| Optional. Define namespace to be used for generated classes. |
NonDebuggerNonUserCode | bool |
| Skip annotation of generated properties with 'DebuggerNonUserCode' |
SuppressNullableSupport | bool |
| Don't use language features of C# 8.0 and up. These are for generating models for tools and dependant plugins. |
Virtual | bool |
| Generate virtual classes/properties |
TypeScript specific parameters
Filters
Parameter | Value type | Default | Description |
---|---|---|---|
EntityFilters | TypeScript only (shrink imports, e.g. odata query or form open) | ||
EntityFormFilters | Generate classes only for these forms, including only the defined attributes, optionsets, tabs, sections and grids. | ||
EntityRefFilter | TypeScript only (shrink imports, e.g. odata query or form open) | ||
Forms | string[] |
| List all forms for which classes should be generated. |
OnlyFormsFromSolutions | bool |
| Generate form classes only for forms included in the solutions defined in the |
Additional content
Parameter | Value type | Default | Description |
---|---|---|---|
BusinessProcessFlows | string[] |
| Generate classes for these BPFs. |
Output management
Parameter | Value type | Default | Description |
---|---|---|---|
TypingPath | string |
| TypeScript typings, e.g. ../../Typings/Xrm/index.d.ts |
EntityFilters
/EntityRefFilters
Parameter | Value type | Default | Description |
---|---|---|---|
Entity | string | Logical name of the table for which the model is to be generated. | |
Attributes | string[] |
| Logical names of the columns inside the table which must be part of the model. |
Optionsets | string[] |
| Logical names of the option sets inside the table which must be part of the model. |
EntityFormFilters
Parameter | Value type | Default | Description |
---|---|---|---|
EntityForm | string | Name of the form for which the model is to be generated. | |
Attributes | string[] |
| Logical names of the columns inside the table which must be part of the form model. |
Optionsets | string[] |
| Logical names of the option sets inside the table which must be part of the form model. |
Tabs | string[] |
| Names of the tabs inside the table which must be part of the form model. |
Sections | string[] |
| Names of the sections inside the table which must be part of the form model. |
Grids | string[] |
| Names of the sub grids inside the table which must be part of the form model. |
Examples
Generate DotNet classes for plugin usage
In this example we use a very common configuration for plugin model generation.
Generate DotNet classes for tool usage, with entity filter
This example generates model for account and contact. In the contact model class it just generates the specified attributes and option sets.