示例#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);
        }
示例#2
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);
        }
示例#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)
			{
				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;
		}
		private IInterceptor[] GetInterceptors(IKernel kernel, ComponentModel model,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(model.Service));
				interceptors[--index] = new WcfRemotingAsyncInterceptor(getAsyncType, clients, channelHolder);
			}

			return interceptors;
		}
		private IInterceptor[] GetInterceptors(IKernel kernel, ComponentModel model, CreationContext context)
		{
			var interceptors = ObtainInterceptors(kernel, model, context);
			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);

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

			return interceptors;
		}