/*----------------------------------------------------------------------------------------*/ /// <summary> /// Search for usercontrols within the parent control /// and inject their dependencies using KernelContainer. /// </summary> /// <param name="parent">The parent control.</param> private static void InjectUserControls(Control parent) { if (parent == null || parent.Controls == null) { return; } foreach (Control control in parent.Controls) { if (control is UserControl) { KernelContainer.Inject(control); } InjectUserControls(control); } }
/*----------------------------------------------------------------------------------------*/ /// <summary> /// Enables processing of HTTP Web requests by a custom HttpHandler that implements the <see cref="T:System.Web.IHttpHandler"></see> interface. /// </summary> /// <param name="context">An <see cref="T:System.Web.HttpContext"></see> object that provides references to the intrinsic server objects (for example, Request, Response, Session, and Server) used to service HTTP requests.</param> public void ProcessRequest(HttpContext context) { KernelContainer.Inject(this); DoProcessRequest(context); }
/*----------------------------------------------------------------------------------------*/ /// <summary> /// Initializes a new instance of the <see cref="WebServiceBase"/> class. /// </summary> protected WebServiceBase() { KernelContainer.Inject(this); }
/*----------------------------------------------------------------------------------------*/ /// <summary> /// Raises the <see cref="E:System.Web.UI.Control.Init"></see> event to initialize the page. /// </summary> /// <param name="e">An <see cref="T:System.EventArgs"></see> that contains the event data.</param> protected override void OnInit(EventArgs e) { base.OnInit(e); KernelContainer.Inject(this); }
/*----------------------------------------------------------------------------------------*/ /// <summary> /// Asks the kernel to inject this instance. /// </summary> protected virtual void RequestActivation() { KernelContainer.Inject(this); }