コード例 #1
0
        public static InstanceChannelProviderConfigurator <TInstance, TChannel> ObtainedBy <TInstance, TChannel>(
            this InstanceChannelConfigurator <TInstance, TChannel> configurator,
            InstanceProvider <TInstance, TChannel> instanceProvider)
            where TInstance : class
        {
            var providerConfigurator = new InstanceChannelProviderConfiguratorImpl <TInstance, TChannel>(() => instanceProvider);

            configurator.SetProviderFactory(providerConfigurator.GetChannelProvider);

            return(providerConfigurator);
        }
コード例 #2
0
        public static DistributedInstanceChannelConfigurator <TInstance, TChannel, TKey> DistributedBy
        <TInstance, TChannel, TKey>(
            this InstanceChannelConfigurator <TInstance, TChannel> configurator, KeyAccessor <TChannel, TKey> keyAccessor)
            where TInstance : class
        {
            var providerConfigurator = new DistributedInstanceChannelConfiguratorImpl <TInstance, TChannel, TKey>(keyAccessor);

            configurator.SetProviderFactory(providerConfigurator.GetChannelProvider);

            return(providerConfigurator);
        }
コード例 #3
0
        public static InstanceChannelProviderConfigurator <TInstance, TChannel> ObtainedBy <TInstance, TChannel>(
            this InstanceChannelConfigurator <TInstance, TChannel> configurator, Func <TChannel, TInstance> consumerFactory)
            where TInstance : class
        {
            Func <InstanceProvider <TInstance, TChannel> > instanceProvider =
                () => new DelegateInstanceProvider <TInstance, TChannel>(consumerFactory);

            var providerConfigurator = new InstanceChannelProviderConfiguratorImpl <TInstance, TChannel>(instanceProvider);

            configurator.SetProviderFactory(providerConfigurator.GetChannelProvider);

            return(providerConfigurator);
        }