static void Main(string[] args) { Param param = new Param() { Table = "Person", Column = "Name", Key = "Id" }; DataBase db = new MyDataBase(); LogDecorator logDecorator = new LogDecorator(db); ExceptionDecorator exceptionDecorator = new ExceptionDecorator(logDecorator); logDecorator.Query(param); try { exceptionDecorator.Query(param); } catch (DataBaseException e) { Console.WriteLine("Error: " + e.Message); } }
public static void Main(string[] args) { var reverser = new ReverseBehavior(); var exceptionDecorator = new ExceptionDecorator(reverser); var loggingDecorator = new LoggingDecorator(exceptionDecorator); var threadingDecorator = new ThreadingDecorator(loggingDecorator); var timerDecorator = new TimerDecorator(threadingDecorator); //var nullDecorator = new NullDecorator(timerDecorator); var result = timerDecorator.Apply("abc"); Console.WriteLine(result); Console.ReadKey(); }