且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

ASP.NET MVC:如何创建自己的HttpContext

更新时间:2023-02-20 12:54:01

我建议你只需要添加一个新的属性,以你的基地控制器将分享自己的上下文。这是最简单的,优雅的和快速的方式来完成这项工作。结果
如果您使用的是一些国际奥委会,我建议你做一个属性注入它,看到的此链接了解详情。

I recommend you just add a new property to your base controller that will share your own context. It's the most easy, elegant and fast way to do the job.
If you are using some IOC, I recommend you to do a property injection for it, see this link for details.