private static void AddErrorHandlers(ServiceHost serviceHost, IKernel kernel, IWcfBurden burden)
        {
            var errorHandlers = new KeyedByTypeCollection <IErrorHandler>();

            WcfUtils.AddBehaviors(kernel, WcfExtensionScope.Services, errorHandlers, burden, errorHandler =>
                                  WcfUtils.RegisterErrorHandler(serviceHost, errorHandler, true));
        }
Exemple #2
0
 private static void BindServiceHostAware(ServiceHost serviceHost, IKernel kernel, IWcfBurden burden)
 {
     WcfUtils.AddBehaviors <IServiceHostAware>(kernel, WcfExtensionScope.Services, null, burden, serviceHostAware =>
     {
         WcfUtils.BindServiceHostAware(serviceHost, serviceHostAware, true);
         return(true);
     });
 }
 private static void BindChannelFactoryAware(ChannelFactory channelFactory, IKernel kernel, IWcfBurden burden)
 {
     WcfUtils.AddBehaviors <IWcfPolicy>(kernel, WcfExtensionScope.Undefined, null, burden, null);
     WcfUtils.AddBehaviors <IChannelFactoryAware>(kernel, WcfExtensionScope.Clients, null, burden,
                                                  channelFactoryAware =>
     {
         WcfUtils.BindChannelFactoryAware(channelFactory, channelFactoryAware, true);
         return(true);
     });
 }
Exemple #4
0
        private static void AddErrorHandlers(ServiceHost serviceHost, IKernel kernel, IWcfBurden burden)
        {
            var errorHandlers = new List <IErrorHandler>();

            WcfUtils.AddBehaviors(kernel, WcfExtensionScope.Services, errorHandlers, burden, errorHandler => WcfUtils.IsBehaviorExtension(errorHandler) == false);
            if (errorHandlers.Count > 0)
            {
                WcfUtils.RegisterErrorHandlers(serviceHost, errorHandlers);
            }
        }
Exemple #5
0
        private static void AddServiceHostExtensions(ServiceHost serviceHost, IKernel kernel, IWcfBurden burden)
        {
            var extensions = new KeyedByTypeCollection <IExtension <ServiceHostBase> >();

            WcfUtils.AddBehaviors(kernel, WcfExtensionScope.Services, extensions, burden, extension =>
            {
                serviceHost.Extensions.Add(extension);
                return(true);
            });
        }
        public void Install(ServiceEndpoint endpoint, bool withContract, IKernel kernel, IWcfBurden burden)
        {
            WcfUtils.AddBehaviors(kernel, scope, endpoint.Behaviors, burden);

            if (withContract)
            {
                WcfUtils.AddBehaviors(kernel, scope, endpoint.Contract.Behaviors, burden);

                foreach (var operation in endpoint.Contract.Operations)
                {
                    WcfUtils.AddBehaviors(kernel, scope, operation.Behaviors, burden);
                }
            }
        }
Exemple #7
0
 private static void AddServiceBehaviors(ServiceHost serviceHost, IKernel kernel, IWcfBurden burden)
 {
     WcfUtils.AddBehaviors(kernel, WcfExtensionScope.Services,
                           serviceHost.Description.Behaviors, burden, behavior =>
     {
         if (behavior is ServiceBehaviorAttribute)
         {
             serviceHost.Description.Behaviors.Remove <ServiceBehaviorAttribute>();
         }
         else if (behavior.GetType() == typeof(ServiceDebugBehavior))
         {
             serviceHost.Description.Behaviors.Remove <ServiceDebugBehavior>();
         }
         else if (behavior is AspNetCompatibilityRequirementsAttribute)
         {
             serviceHost.Description.Behaviors.Remove <AspNetCompatibilityRequirementsAttribute>();
         }
         return(true);
     });
 }