Sunday, March 8, 2015

Chain of Responsibility design pattern with Dynamic handlers

This is the Chain of responsibility pattern with dynamic handler which can handler. With this we can assign dynamic handler for the request without touching the main handler.
The following is the image shows the list of projects I have used in the demo project.
1. PatternTest --> is the actual client which will use the design pattern
2. Core --> is the Main project which will have default implementation
3. AddOn --> this is the first add on which will extend the core functionality like that we have AddOnTwo and AddOnThree project. 
1. PatternTest
In this Project we have two important files ManageHandlers.cs and Handler.xml. These two files provide the dynamic behaviour.
 
  • ManageHandler.cs: This file contains the code that will load the handlers for the main request. This will take the handler details from Handler.xml file
  • Handler.xml: This file contains the details about dynamic handlers. Assembly path name and class name (Including the namespace).
2. Core
In this Project we have the main business logic. It will deals with the required logic for default implementation for all the possible scenario.
3. AddOn One, Two and Three
These projects deals with specific scenario. These will extend the core functionality and provide the additional functionality. The execution of these add ons will be controlled from the Core module it self using the Handler.xml file.

Link to the Sample Project is here Download

No comments:

Post a Comment