How can I get Castle Windsor to automatically inject a property?

元气小坏坏 提交于 2019-12-03 14:14:23

The lambda parameter for AddFacility is actually a creation callback (it gets called when the facility is created), not a factory.

Use this instead:

container.AddFacility("logging", new LoggingFacility(LoggerImplementation.Log4net, "path_to_log4net.config"));

BTW Windsor automatically injects property dependencies whenever it can.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!