예제 #1
0
        /// <summary>
        /// Configure DataContractResolver.
        /// </summary>
        /// <typeparam name="TChannel">The channel to be used to connect to the service.</typeparam>
        /// <param name="source">The source TChannel.</param>
        /// <param name="setDataContractResolverAction">A delegate to configure DataContractSerializerOperationBehavior.</param>
        public static void SetDataContractResolver <TChannel>(this TChannel source, Action <DataContractSerializerOperationBehavior> setDataContractResolverAction) where TChannel : class
        {
            WcfClientBase <TChannel> wcfClient = source as WcfClientBase <TChannel>;

            if (wcfClient != null)
            {
                wcfClient.SetDataContractResolverAction = setDataContractResolverAction;
            }
        }
예제 #2
0
        /// <summary>
        /// Configure the client binding.
        /// </summary>
        /// <typeparam name="TChannel">The channel to be used to connect to the service.</typeparam>
        /// <param name="source">The source TChannel.</param>
        /// <param name="setBindingAction">A delegate to configure Binding.</param>
        public static void SetBinding <TChannel>(this TChannel source, Action <Binding> setBindingAction) where TChannel : class
        {
            WcfClientBase <TChannel> wcfClient = source as WcfClientBase <TChannel>;

            if (wcfClient != null)
            {
                wcfClient.SetBindingAction = setBindingAction;
            }
        }
예제 #3
0
        /// <summary>
        /// Configure the client credentials.
        /// </summary>
        /// <typeparam name="TChannel">The channel to be used to connect to the service.</typeparam>
        /// <param name="source">The source TChannel.</param>
        /// <param name="setClientCredentialsAction">A delegate to configure ClientCredentials.</param>
        public static void SetClientCredentials <TChannel>(this TChannel source, Action <ClientCredentials> setClientCredentialsAction) where TChannel : class
        {
            WcfClientBase <TChannel> wcfClient = source as WcfClientBase <TChannel>;

            if (wcfClient != null)
            {
                wcfClient.SetClientCredentialsAction = setClientCredentialsAction;
            }
        }
        /// <summary>
        /// Adds the endpoint behavior.
        /// </summary>
        /// <typeparam name="TChannel">The type of the channel.</typeparam>
        /// <param name="source">The source.</param>
        /// <param name="endpointBehavior">The endpoint behavior.</param>
        /// <returns>The endpoint behavior to add.</returns>
        public static IEndpointBehavior AddEndpointBehavior <TChannel>(this WcfClientBase <TChannel> source, IEndpointBehavior endpointBehavior) where TChannel : class
        {
            source.Endpoint.Behaviors.Add(endpointBehavior);

            return(endpointBehavior);
        }