-
Notifications
You must be signed in to change notification settings - Fork 11
IOC integration
gimmi edited this page Oct 30, 2011
·
5 revisions
To integrate ExtDirectHandler with your favourite IoC container you have to set a new DirectHandlerInterceptor in DirectHttpHandler. Add the following code to Global.asax's Application_Start:
public class Global : HttpApplication
{
protected void Application_Start(object sender, EventArgs e)
{
...
var container = new WindsorContainer();
...
DirectHttpHandler.SetDirectHandlerInterceptor(delegate(Type type, MethodInfo method, DirectHandlerInvoker invoker) {
var actionInstance = container.Resolve(type);
invoker.Invoke(actionInstance);
container.Release(actionInstance); // If needed by your IOC (better to place it in a finally block)
});
...
}
...
}