Tutorial: Create an Event as a Designer Extension
This tutorial guide will walk you through creating a Designer Extension which extends the Domain Designer such that in addition to everything it already supports, it will also allow:
- Adding a new element of type
Domain Event
which can be added through a context menu option on folders. - Ability to apply a new Stereotype to
Class
elements. - Have a property on the above Stereotype which allows selection of
Domain Event
element types created in that Designer's Package.
Create a new Application
Create a new Module Builder
application and give it the name DomainDesignerExtension
:
Click NEXT
and on the following screen ensure that the following extra options are ticked:
Module Builder - C#
.Auto-Build Module
:
Click CREATE
:
Once the Application Installation
is complete, you will see a Ready
message in the Taskbar
.(bottom left of Intent Architect).
Install the Domain designer
- Right-Click on the
DomainDesignerExtension
Application and select theManage Modules
option. - Search for
Intent.Modelers.Domain
. - Expand
Options
on the right. - Check
Install metadata only
. - Click
Install
:
[!Video-Loop videos/install-domain-module-metadata.mp4]
Configure the package to reference the domain designer
- Click on the
Module Builder
Designer on the left. - Select the top-level Package node and in the Properties pane on the right:
- Check
Include in Module
. - Add
Domain
toReference in Designer
.
- Check
[!Video-Loop videos/design-setup-designer-reference.mp4]
Create and configure the Domain Event
element
- Right-click the root Package element and click the
Add Designers Folder
option. - Right-click the
designers
element and click theNew Designer Settings
option. - Give the new element a name of
DomainEventSettings
. - Select the
DomainEventSettings
element and in the Properties pane on the right:- For
Extend Designers
addDomain
.
- For
- Right-click the
DomainEventSettings
element and click theNew Element Type
option. - Give the new element a name of
Domain Event
. - Right-click the
Domain Event
element and click theAdd Element Settings
option. - Give the new element a name of
Property
- Select the
Property
element and in the Properties pane on the right:- Change
Mode
toRequired
. - For
Target Types
addClass
,Enum
andType-Definition
.
- Change
- Right-click the
[context-menu]
element (the one directly withinDomain Event
) and click theAdd Element Creation
option. - Give the new element a name of
Add Property
and select theProperty
type for it:
Create an Add Event
context menu option for Folder
elements
- Right-click the
DomainEventSettings
and click theNew Element Extension
option. - Give the new element a name of
Folder Extension
and select theFolder
type for it. - Right-click the
Folder Extension
element and click theAdd Menu Options
option. - Right-click the
[context-menu]
element (the one directly withinFolder Extension
) and click theAdd Element Creation
option. - Give the new element a name of
Add Event
and select theDomain Event
type for it:
Create an Add Event
context menu option for Package
elements
- Right-click the
DomainEventSettings
and click theNew Package Extension
option. - Give the new element a name of
Package Settings
and select theDomain Package
type for it. - Right-click the
[context-menu]
element (the one directly withinPackage Settings
) and click theAdd Element Creation
option. - Give the new element a name of
Add Event
and select theDomain Event
type for it:
Create the Stereotype
- Right-click the root Package element and click the
New Stereotype-Definition
option. - Give the new Stereotype Definition a name of
Has Domain Event
. - Select the
Has Domain Event
element and in the Properties pane on the right:- For
Target Types
addClass
.
- For
- Right-click the
Has Domain Event
element and click theAdd Property
option. - Give the Property a name of
Event
. - Select the
Event
element and in the Properties pane on the right:- Change
Control Type
toSelect
. - Change
Option Source
toLookup Element
. - For
Lookup Types
addDomain Event
:
- Change
[!Video-Loop videos/create-the-stereotype.mp4]
Run the Software Factory to generate the module
Run the Software Factory and optionally review the proposed changes:
Click APPLY CHANGES
.
After the Software Factory has applied the changes, you'll see that it runs dotnet build
on the generated Visual Studio
solution:
Take note of the following line in the output for the following step:
Successfully created module C:\Code\MySolution\Intent.Modules\DomainDesignerExtension.1.0.0.imod
Click CLOSE
.
Test your Designer Extension Module
Ensure you have added the output path as noted in the above step as a repository in the Repository Manager. For the above output, the full path of the module is C:\Code\MySolution\Intent.Modules\DomainDesignerExtension.1.0.0.imod
, so the repository would point to its folder, which is C:\Dev\MySolution\Intent.Modules
:
- Open or create the Intent Architect application where you want to install your newly created Module.
- Right-Click on the application and select
Manage Modules
. - Ensure the application has the
Intent.Modelers.Domain
module installed. - Select your repository from the drop-down on the right and locate your Module to install:
You will now have the option of creating the new Domain Event
element and using it in the Has Domain Event
Stereotype that was added by the Designer Extension we created above:
[!Video-Loop videos/test-module-domain.mp4]