Pre & Post Processors are hook-able logic that would help you to execute before or after certain actions executed by Cello. For example, When creating a Tenant, Cello first makes an entry in the Tenant Details Entity then creates an entry in Contact details entity etc, so in certain scenarios where you want to execute some other logic before creating the tenant you could use Pre-Processor to hook it, similarly if you want execute anything after the flow you could utilize Post Processor.


Please follow the below procedure, to define Pre/Post Processor


1) Implement Pre/Post processor classes that inherits from IPreProcessorProvider/IPostProcessorProvider.

 

Refer : TenantValidationPreProcessor.cs &

   TenantValidationPostProcessor.cs (Attached files)



2) Register the Pre/Post processor classes in Web.Config file.

 

 

<processors>
 <postprocessors>
<add name="TenantValidationPreProcessor" assembly="WebApplication" type="WebApplication.Models.TenantValidationPreProcessor"/>
 </postprocessors>
 <preprocessors>
<add name="TenantValidationPostProcessor" assembly="WebApplication" type="WebApplication.Models.TenantValidationPostProcessor"/>
 </preprocessors>
</processors>

 

 

3) If you want to run the pre/post processors while tenant creation then add the above configuration under Tenant Provision Setting section.

 

 

<TenantProvisionSetting defaultProvider="Default">
<PreProcess>
<add name="Default" assembly="WebApplication" type="WebApplication.Models.TenantValidationPreProcessor" />
</PreProcess>
<PostProcess>
<add name="Default" assembly="CelloSaaS.Services" type="CelloSaaS.Services.TenantManagement.DefaultScriptPostProcess"/>
</PostProcess>
</TenantProvisionSetting>

 

 


For more details please refer : How-To-Guide