Custom Modules Templates for Dotnet New¶
In this guide, we will learn how to create own custom module using dotnet new
templates for Virto Commerce modules. This feature allows you to create a Virto Commerce module with a pre-configured entity, simplifying the development and integration of new components.
Template Name | Description |
---|---|
vc-module-dba-xapi | Creates a new Virto Commerce module with DB Agnostic and xAPI support. |
vc-module-dba | Creates a new Virto Commerce module with DB Agnostic support. |
vc-module-xapi | Creates a new Virto Commerce module with xAPI support. |
vc-crud | Creates all the classes needed for CRUD operations. |
Install¶
To install the templates, run:
Create new module from template¶
To create new module:
- Open Windows PowerShell console.
- Navigate to your sources folder.
-
Run one of the following commands depending on the type of module you want to create:
dotnet new vc-module-dba-xapi --ModuleName CustomerReviews --Author "Jon Doe" --CompanyName VirtoCommerce
dotnet new vc-module-dba --ModuleName CustomerReviews --Author "Jon Doe" --CompanyName VirtoCommerce
dotnet new vc-module-xapi --ModuleName CustomerReviews --Author "Jon Doe" --CompanyName VirtoCommerce
Parameters
Options Description Type Required Default value --Author (or -A) Your name string Optional John Doe --CompanyName (or -C) Your company name string Optional VirtoCommerce --ModuleName (or -M) Your module name string Optional NewModule --ModuleVersion Your module version string Optional 3.800.0 --PlatformVersion (or -P) Virto Commerce platform version string Optional 3.876.0 --CoreVersion Virto Commerce Core module version string Optional 3.800.0 --XapiVersion (or -X) XAPI module version string Optional 3.901.0 -
A vc-module-customer-reviews folder with module solution has been created.
Info
You can pass PlatformVersion attribute to create a new module for specific version of Virto Commerce.
Create CRUD classes from template¶
To create CRUD classes from template, run the following command:
Parameters
Options | Description | Type | Required | Default value |
---|---|---|---|---|
--CompanyName (or -C) | Your company name | string | Optional | VirtoCommerce |
--ModuleName (or -M) | Your module name | string | Optional | NewModule |
--EntityName (or -E) | New entity name | string | Optional | FooBar |
It will create a folder called vc-module-customer-reviews with models, events, and services needed for CRUD operations. The company name and the module name are used to create the namespace for new classes.
Note
You can simply copy most of these files into your module, but you will need to merge new DbContext.cs, Repository.cs, and Module.cs files with existing ones.
Uninstall¶
To uninstall templates, run:
Contribute¶
To improve and extend the module creation process, contribute to the dotnet new templates by:
Install templates locally¶
To install templates locally:
- Open Windows PowerShell console
-
Clone repository
-
Install downloaded templates:
Uninstall locally installed templates¶
To uninstall locally installed templates, run: