Action Delegate Pipeline

The Pipeline or Workflow is a collection of Action methods that validates info, execute functions and/or modifies the data context. It was built for a more flexible and extensible development structure, if you need to add your custom logic or even replace any RazorCart Core method with your own code you might want to use this Visual Studio example project as a start to create your Pipeline Action methods that will override the core methods.



  • Microsoft Visual Studio 2012 or newer
  • C# development skills

Getting Started

1. The first step is to download the Visual Studio example project:

  Download the Integration Example Project

2.  Unzip the file you just downloaded and place it in the Library folder in your DNN root folder

3. Open the project in Visual Studio, you will see that the project contains 4 classes, MyPipeline class which inherited from RazorCart.Core.ActionPipeline.PipelineManager is the key class that will override the Core Pipeline Action List... NOW any Pipeline Action you adds to your project will override the base Action, we have added four examples for the three Pipeline types we have in RazorCart.
4. PipelineAction Properties:
  1. ActionID: an integer identity value for the action method, this value will be shown in the Event Viewer if your code throw an exception.
  2. ActionName: a string value to describe your action name, this will be also display in the Event Viewer if your code throw an exception.
  3. IsDisposable: a Boolean value, if set to FALSE that means if your Action return a NOT successful result or was thrown an exception the Workflow will be terminated and will skip the next Action(s).
  4. Execute: this is where you will have your code that will overrides the original one, the Workflow Actions handle the inputs/output by modifying the Context value which will be delivered to the next action, also each action must return an ActionEndResult of a Success = True/False, and a FailureMessage that will be displayed to the end-user if the result was unsuccessful and the action was disposable.
5. Pipeline Types:
  1. CartPipeline: The cart operation workflow actions, get called when you add an item to the shopping cart.
  2. CalculatorPipeline: The cart totals calculation workflow actions, get called when calculating the cart totals.
  3. CheckoutPipeline: The checkout operation workflow actions, get called when the user proceed with the checkout.

Some Examples

We have included some examples with the above project for overriding the base functions:
  1. CartPipeline.PreAddToCart() method: here we have two validations, the first one will prevent any customer from adding any item to the shopping cart if the cart contains items with $100 or more in subtotal, the second validation will prevent the user from adding a specific item if he's not logged in.
  2. CartPipeline.OnAddToCartComplete() method: the example code here will send an email to the user once the item was successfully added to the shopping cart.
  3. CalculatorPipeline.CalculateTax() method: we are showing you here how to overrides the tax calculation method, a small example will collect an 8% tax only within the United States.
  4. CheckoutPipeline.OnCheckoutComplete() method: if you have a web service that you need to handle and process your orders after the customer successfully placed an order, this would be a good start for you.

Building & Deploying

After you build your integration plugin assembly and deploy it to your DNN\bin folder, you will need to select which Store will use this extension, go to your store Admin Console > Store Setup > Extension and from the Integration Namespace drop-down menu find your assembly namespace and click Save, once you save your settings a list of the active Pipeline Actions will be displayed to confirm what methods are now overridden.
To access the Extensibility Setup page click on the Admin Menu in your DNN portal, then select RazorCart Admin Console:
You will be taken to the dashboard of your store. 
From the left-side menu go to Store Setup > Extension
Open the Integration Namespace drop-down menu and select the Namespace you have chosen when you build your Visual Studio project and click Save
Once you save your setting a list contains the Pipeline Action List will be display

Now you have successfully overridden some of the RazorCart Core methods with the ones you just deployed! If you have any questions, please Contact Us.

Add Feedback