用.Net Core控制台模拟一个ASP.Net Core的管道模型
在我的上几篇文章中降到了asp.net core的管道模型,为了更清楚地理解asp.net core的管道,再网上学习了.Net Core控制台应用程序对其的模拟,以加深映像,同时,供大家学习参考。 首先,新建一控制台应用程序。注意是.Net Core的控制台应用程序。 然后新建一个Context类,以模拟ASP.net core中的context类,然后再Context类中添加一个Write方法。 using System; using System.Collections.Generic; using System.Text; using System.Threading.Tasks.Dataflow; namespace MyPipleLine { public class Context { public void Write(string msg) { Console.WriteLine(msg); } } } 然后新建一个RequestDelegate类,类中声明一个Requestdelegate的委托。 using System; using System.Collect...