public void Main_Pattern() { //创建型 5 SingletonPattern.Used(); SimpleFactory.Used(); AbstructFactory.Used(); BuilderParttern.Used(); PrototypePattern.Used(); //结构型 7 AdapterPattern.Used(); BridgePattern.Used(); DecoratorPattern.Used(); CompositePattern.Used(); FlyweightPattern.Used(); FacadePattern.Used(); ProxyPattern.Used(); //行为型 11 ChainOfResponsibilityPattern.Used(); CommandPattern.Used(); InterpreterPattern.Used(); //特殊类型 熔断器模式 }
public static void ResponsibilityChainDemo() { var rc = new ChainOfResponsibilityPattern(); rc.Demo(); }
public Task StartAsync(CancellationToken cancellationToken) { Console.WriteLine(_configuration["Logging:LogLevel:Default"]); IDesignPattern specificationPattern = new SpecificationPattern(); specificationPattern.ExecuteSample(); IDesignPattern factoryMethod = new FactoryMethodPattern(); factoryMethod.ExecuteSample(); IDesignPattern singletonPattern = new SingletonPattern(); singletonPattern.ExecuteSample(); IDesignPattern commandPattern = new CommandPattern(); commandPattern.ExecuteSample(); IDesignPattern chainOfResponsibilityPattern = new ChainOfResponsibilityPattern(); chainOfResponsibilityPattern.ExecuteSample(); IDesignPattern decoratorPattern = new DecoratorPattern(); decoratorPattern.ExecuteSample(); IDesignPattern strategyPattern = new StrategyPattern(); strategyPattern.ExecuteSample(); IDesignPattern abstractFactoryPattern = new AbstractFactoryPattern(); abstractFactoryPattern.ExecuteSample(); IDesignPattern compositePattern = new CompositePattern(); compositePattern.ExecuteSample(); IDesignPattern bridgePattern = new BridgePattern(); bridgePattern.ExecuteSample(); IDesignPattern observerPattern = new ObserverPattern(); observerPattern.ExecuteSample(); IDesignPattern statePattern = new StatePattern(); statePattern.ExecuteSample(); IDesignPattern mediatorPattern = new MediatorPattern(); mediatorPattern.ExecuteSample(); IDesignPattern visitorPattern = new VisitorPattern(); visitorPattern.ExecuteSample(); IDesignPattern momentoPattern = new MomentoPattern(); momentoPattern.ExecuteSample(); return(Task.CompletedTask); }