Does anyone know if it is possible to inject the current WCF
WebOperationContext into a class that implements IErrorHandler? My
ErrorHandler is instantiated via a WebHttpBehavior that is
instantiated via "new DefaultServiceModel().AddExtensions(new
MyWebHttpBehavior())". Therefore my ErrorHandler is created once, but
I need it to be injected with the current WCF WebOperationContext. Any
ideas how to do this?

Here's what MyWebHttpBehavior looks like and how it is configured in
the container....

 Container.AddFacility<WcfFacility>()
   .Register(
    ...
        Component.For...
          .ActAs(
             new DefaultServiceModel()
               ...
               .AddExtensions(new MyWebHttpBehavior())
           )
   );

   public class MyWebHttpBehavior: WebHttpBehavior
   {
        protected override void AddServerErrorHandlers(ServiceEndpoint
endpoint, EndpointDispatcher ed)
        {
            // TODO  MyErrorHandler should be injected by the Ioc
container
            ed.DispatchRuntime.ChannelDispatcher.ErrorHandlers.Add(new
MyErrorHandler());
        }
    }

And here's MyErrorHandler

    class MyErrorHandler: IErrorHandler
    {
        ...
        public void ProvideFault(...)
        {
            // TODO WebOperationContextWrapper should be injected by
the Ioc container
             var currentWebOperationContext = new
WebOperationContextWrapper(WebOperationContext.Current);
              ...
        }
    }

Cheers,

Craig

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" group.
To post to this group, send email to castle-project-users@googlegroups.com
To unsubscribe from this group, send email to 
castle-project-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/castle-project-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to