Exemple #1
0
        private IInterceptor[] GetInterceptors(IKernel kernel, ComponentModel model, Type serviceContract, IWcfChannelHolder channelHolder, CreationContext context)
        {
            var interceptors = ObtainInterceptors(kernel, model, context);

            // TODO: this should be static and happen in IContributeComponentModelConstruction preferably
            var clientModel = (IWcfClientModel)model.ExtendedProperties[WcfConstants.ClientModelKey];

            Array.Resize(ref interceptors, interceptors.Length + (clientModel.WantsAsyncCapability ? 2 : 1));
            int index = interceptors.Length;

            interceptors[--index] = new WcfRemotingInterceptor(clients, channelHolder);

            if (clientModel.WantsAsyncCapability)
            {
                if (channelHolder.RealProxy == null)
                {
                    throw new InvalidOperationException(string.Format(
                                                            "Component {0} requested async support, but the channel does not support this capability.", model.Name));
                }
                var getAsyncType = WcfUtils.SafeInitialize(ref asyncType, () => AsyncType.GetAsyncType(serviceContract));
                interceptors[--index] = new WcfRemotingAsyncInterceptor(getAsyncType, clients, channelHolder);
            }

            return(interceptors);
        }
Exemple #2
0
 public override Type[] GetInterfaces()
 {
     return(WcfUtils.SafeInitialize(ref interfaces, () =>
     {
         var effectiveInterfaces = syncType.GetInterfaces();
         for (int i = 0; i < effectiveInterfaces.Length; ++i)
         {
             effectiveInterfaces[i] = GetEffectiveType(effectiveInterfaces[i]);
         }
         return effectiveInterfaces;
     }));
 }
Exemple #3
0
        private IInterceptor[] GetInterceptors(IKernel kernel, ComponentModel model, Type serviceContract, IWcfChannelHolder channelHolder, CreationContext context)
        {
            var interceptors = ObtainInterceptors(kernel, model, context);

            // TODO: this should be static and happen in IContributeComponentModelConstruction preferably
            var clientModel = (IWcfClientModel)model.ExtendedProperties[WcfConstants.ClientModelKey];

            Array.Resize(ref interceptors, interceptors.Length + (clientModel.WantsAsyncCapability ? 2 : 1));
            int index = interceptors.Length;

            interceptors[--index] = new WcfRemotingInterceptor(clients, channelHolder);

            if (clientModel.WantsAsyncCapability)
            {
                var getAsyncType = WcfUtils.SafeInitialize(ref asyncType, () => AsyncType.GetAsyncType(serviceContract));
                interceptors[--index] = new WcfRemotingAsyncInterceptor(getAsyncType, clients, channelHolder);
            }

            return(interceptors);
        }