760 views
In this article, we will cover the common naming conventions found within Sitecore Experience Commerce to maintain a consistent approach in our custom plugins.
CRUD Operations
Starting with some simple CRUD operations, the following tables documents the naming conventions to utilise for the various Commerce classes
Entities
Create Entity
Naming Convention: Add<entity><context>
Commerce Reference | Example |
---|---|
Controller Action | AddPriceBook (CommandsController) |
Command | AddPriceBookCommand |
Model | PriceBookAdded |
Pipeline | AddPriceBookPipeline |
Pipeline Argument | AddPriceBookArgument |
Pipeline Block | AddPriceBookBlock |
Read Entity
Naming Convention: Get<entity><context>
Commerce Reference | Example |
---|---|
Controller Action | Get (<Entity>Controller) |
Command | N/A. Use FindEntityCommand instead |
Model | FoundEntity (handled within FindEntityCommand) |
Pipeline | IFindEntityPipeline (handled within FindEntityCommand) |
Pipeline Argument | FindEntityArgument (handled within FindEntityCommand) |
Pipeline Block | SQL.FindEntityBlock (handled within FindEntityCommand) |
Update Entity
Naming Convention: Update<entity><context>
Commerce Reference | Example |
---|---|
Controller Action | EditPriceBook (CommandsController) |
Command | EditPriceBookCommand |
Model | PriceBookEdited (No current usages) |
Pipeline | EditPriceBookPipeline |
Pipeline Argument | EditPriceBookArgument |
Pipeline Block | EditPriceBookBlock |
Delete Entity
Naming Convention: Delete<entity><context>
Commerce Reference | Example |
---|---|
Controller Action | DeletePriceCard. (CommandsController)
Note: When deleting entities, it is important to consider how references to these entities need to be handled, as well as any child entity dependencies that may also need to be deleted, which would otherwise be orphaned. |
Command | DeletePriceBookCommand |
Model | PriceCardDeleted (No current usages) |
Pipeline | IDeleteEntityPipeline |
Pipeline Argument | DeleteEntityArgument (handled within IDeleteEntityPipeline) |
Pipeline Block | DeleteEntityBlock (handled within IDeleteEntityPipeline) |
Components
Create Component
Naming Convention: Add<component><context>
Commerce Reference | Example |
---|---|
Controller Action | AddCartLine |
Command | AddCartLineCommand |
Model | LineAdded |
Pipeline | AddCartLinePipeline |
Pipeline Argument | CartLineArgument |
Pipeline Block | AddCartLineBlock |
Read Component
Naming Convention: N/A
Components only exist to extend entities and therefore will not live in isolation to be queried. If a component was to be queried it would be to retrieve it in the context of an entity and therefore the entity would be retrieved instead.
Update Component
Naming Convention: Update<component><context>
Commerce Reference | Example |
---|---|
Controller Action | UpdateCartLine |
Command | UpdateCartLineCommand |
Model | LineUpdated |
Pipeline | UpdateCartLinePipeline |
Pipeline Argument | CartLineArgument |
Pipeline Block | UpdateCartLineBlock |
Delete Component
Naming Convention: Update<component><context>
Commerce Reference | Example |
---|---|
Controller Action | RemoveCartLine |
Command | RemoveCartLineCommand |
Model | LineRemoved (No current usages) |
Pipeline | RemoveCartLinePipeline |
Pipeline Argument | CartLineArgument |
Pipeline Block | RemoveCartLineBlock |
Business Tools
Pipeline Block Naming Convention | Example | Description |
---|---|---|
Get<Navigation Entity View>ViewBlock | GetInventoryNavigationViewBlock | Creates and constructs a navigation entity view |
Get<Dashboard Entity View>ViewBlock | GetInventoryDashboardViewBlock | Creates and constructs a dashboard entity view |
Get<Entities>ViewBlock | GetInventorySetsViewBlock | Creates and constructs an entity view for managed lists |
Get<Entity>DetailsViewBlock | GetInventoryDetailsViewBlock | Creates and constructs an entity view for a specific entity |
Populate<Entity View>ViewActionsBlock | PopulateInventorySetsViewActionsBlock | Populates the actions of an entity view |
DoAction<Action Name>Block | DoActionAddInventorySetBlock | Handles the logic of an entity view action |
Miscellaneous
Commerce Reference | Example |
---|---|
Persist<Entity>Block | PersistCartEntity |
Initialize<Entity/Entities>Block | InitializeCatalogBlock |
<Entity>Argument (Pipeline Argument) | CartArgument |
<Entity><Entity>Argument (Pipeline Argument) | CartPartyArgument |