IOC依赖注入定义HTTP模块 - 怎么样? (ASP.NET) [英] IoC Dependency injection into Custom HTTP Module - how? (ASP.NET)

查看:146
本文介绍了IOC依赖注入定义HTTP模块 - 怎么样? (ASP.NET)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个自定义HTTP模块。我想用我的IoC框架注入记录器,这样我就可以在模块中记录错误。不过,当然我没有得到一个构造函数,所以不能将其注入到这一点。什么是去了解这一点的最好方法是什么?

I have a custom HTTP Module. I would like to inject the logger using my IoC framework, so I can log errors in the module. However, of course I don't get a constructor, so can't inject it into that. What's the best way to go about this?

如果您需要的特定的IoC容器 - 我目前使用的温莎,但可能很快转移到AutoFac

If you need the specific IoC container - I'm currently using Windsor, but may soon move to AutoFac.

感谢

推荐答案

我刚刚的回答关于我的博客这个问题。

又见的http://lozanotek.com/blog/archive/2009/08/19/Autowire_IHttpModules_with_IoC.aspx

这篇关于IOC依赖注入定义HTTP模块 - 怎么样? (ASP.NET)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆