使用温莎城堡注入IRailsEngineContext
问题
我在 Castle Monorail 项目中使用 Castle Windsor 作为 IoC 容器。 我想将 IRailsEngineContext 的当前实例注入到从控制器中的容器解析的对象中。
上下文
我想要将 Rails 上下文注入的对象将用于包装会话对象,以便保留以前查看的记录的 id。 然后将引用它以确保它们不会被再次查看。
替代解决方案
我可以在每次调用时将上下文传递给方法或手动注入它,但最好直接从容器注入它。
问题
我想不出一种在容器内注入上下文的方法。 有没有办法做到这一点? 这还有道理吗?
Issue
I am using Castle Windsor as an IoC container in a Castle Monorail project. I would like to inject the current instance of IRailsEngineContext into an object being resolved from the container in a controller.
Context
The object I would like inject the rails context into would be used to wrap the session object for the purpose of retaining the ids of previously viewed records. It would then be referenced to ensure that they aren't viewed again.
Alternate Solutions
I could pass the context to the methods with each call or inject it manually, but it would be nice to inject it directly from the container.
Question
I can't think of a way to inject the context within the container. Is there a way to do this? Does this even make sense?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
IRailsEngineContext - 我猜它来自 MonoRail 的旧版本。 我建议你换一个新的,越早越好。
IRailsEngineContext - that's from an old version of MonoRail I guess. I'd advise you move to a newer one, the sooner the better.