Sitecore Patch File Generator cmdline Utility for Event Handlers taking array as args

Just created this Sitecore Event Handler Generator utility that can create event handler patch + associated cs file with a dummy method that you can override.

Should work for the following events :

<event name="item:moving"/>
<event name="item:renamed"/>
<event name="item:deleting"/>
<event name="item:locked"/>
<event name="item:moved">
event name="item:created"/>
<event name="item:cloneAdded"/>
<event name="item:unlocked"/>
<event name="item:versionAdded"/>
<event name="item:versionAdded:remote"/>
<event name="item:versionAdding"/>
<event name="item:versionRemoving"/>
<event name="security:loggingIn"/>
<event name="security:loggedIn"/>
<event name="security:loggingOut"/>

Note that this will work for the event handlers wherein the args is a list of array. For instance, item:moving, item:deleting, item:copying are a few examples of those:


Run this command - 

.\SitecoreEventHandlerGenerator.exe "C:\\Projects\\myclient" "Client.Feature.MyFeature" "MovingMyItem" "EventHandlers" "App_Config\\Include\\" "item:moving"

First arg: Folder path that has app_config\include folder

Second arg: Desired name of the config file (with the  .config file extension)

Third arg: Name of the CS Class that will host the event handler method

Fourth arg: Folder where the event handlers cs file will be saved

Fifth arg: Folder where you want your config file to be generated

Sixth arg: the event name as per show config page:


A sample command in action:

.\SitecoreEventHandlerGenerator.exe "C:\\Projects\\myclient\\" "MyClient.Feature.MyFeature" "CreateMyItem" "MyEventHandlers" "App_Config\\Include\\" "item:moving"


Generated config file:



Note that the method name is auto-generated as ProcessCreateMyItem since I passed that name although I should have passed something relevant to moving an item but the tool does the job since it also generates the method name in the cs file with the same name -



Note that the event handler above gets generated under MyEventHandlers folder and is placed in the corresponding namespace as per the arg list passed in the cmd line.

Github: https://github.com/navancommits/SitecorePatchFileGenerator



Comments