使用 Structuremap 解决 WebForms UserControls 中的依赖关系
我目前正在使用 httpmodule 通过结构图使用 ObjectFactory.BuildUp() 方法注入页面级别权限。
我想对网络表单用户控件做同样的事情。我有一个基本用户控件,我的所有用户控件都继承它。在此我尝试这样做:
public abstract class BaseUserControl : System.Web.UI.UserControl
{
public BaseUserControl()
{
ObjectFactory.BuildUp(this);
}
}
但是,我的依赖项没有注入到我的派生用户控件中。
关于我如何做到这一点有什么想法吗?
I'm currently using a httpmodule to inject my page level permissions using the ObjectFactory.BuildUp() method by structuremap.
I want to do the same thing with webforms user controls. I have a base usercontrol that all my usercontrols inherit. In this I tried to do:
public abstract class BaseUserControl : System.Web.UI.UserControl
{
public BaseUserControl()
{
ObjectFactory.BuildUp(this);
}
}
However, my dependencies are not injected in my derived user controls.
Any ideas as to how I can do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论