event—事件驱动的架构—管道模型
什么叫Asp.NET管道处理模型?
完成Http请求的处理,给一个HttpContext对象,然后处理好得到结果
管道处理模式:
请求处理过程中会有很多步骤,除了生成Html,还有很多事
public event Action InitEventHandler();
public event Action InitAfterEventHandler();
public void Eat(string context){
if(this.InitEventHandler != NULL){
this.InitEventHandler.Invoke();
}
Console.WriteLine($"this cat eat {context}");
Console.WriteLine("xxxxxx");
Console.WriteLine("xxxxxx");
Console.WriteLine("xxxxxx");
if(this.InitAfterEventHandler != NULL){
this.InitAfterEventHandler.Invoke();
}
}
Cat.InitEventHandler += ()=> Console.WriteLine("xxxxxx");
Cat.Eat("fish");