Design Pattern - Behavioral - Chain of Responsibility

Scenario:

Create exclusions for cron scheduler 

Solution:

Behavioral Pattern is used to chain the objects and pass the request along it until an object handles it.

Example: Create exclusions for cron scheduler 
     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    private ICalendar Scheduler(string exclusions)
    {
        ICalendar cal = null;
        var list = exclusions.Split(new[] { ListDelim }, StringSplitOptions.RemoveEmptyEntries);
    
        //chain exclusions
        foreach (var item in list)
        {
            cal = new CronCalendar(cal, item); 
        }
        return cal;
    }

No comments:

Post a Comment

Move Github Sub Repository back to main repo

 -- delete .gitmodules git rm --cached MyProject/Core git commit -m 'Remove myproject_core submodule' rm -rf MyProject/Core git remo...