public static IServiceCollection AddFusionWebSocketClientCore(
     this IServiceCollection services,
     WebSocketChannelProvider.Options options)
 {
     services.TryAddSingleton(options);
     services.TryAddSingleton <IChannelProvider, WebSocketChannelProvider>();
     return(services.AddFusionClientCore());
 }
Пример #2
0
        // Common client-side services

        public static IServiceCollection AddFusionWebSocketClient(
            this IServiceCollection services,
            WebSocketChannelProvider.Options options)
        {
            services.TryAddTransient <FusionResponseDeserializer>();
            services.AddRestEaseCore();
            return(services.AddFusionWebSocketClientCore(options));
        }
Пример #3
0
 public static IServiceCollection AddFusionWebSocketClient(
     this IServiceCollection services,
     WebSocketChannelProvider.Options options,
     bool addTransient = false)
 {
     services.TryAddSingleton(options);
     services.TryAddSingleton <IChannelProvider, WebSocketChannelProvider>();
     return(services.AddFusionClientCore().AddFusionRestEaseServices());
 }
Пример #4
0
        public FusionRestEaseClientBuilder ConfigureWebSocketChannel(
            WebSocketChannelProvider.Options options)
        {
            var serviceDescriptor = new ServiceDescriptor(
                typeof(WebSocketChannelProvider.Options),
                options);

            Services.Replace(serviceDescriptor);
            return(this);
        }
 public static IServiceCollection AddFusionWebSocketClientCore(
     this IServiceCollection services,
     Action <IServiceProvider, WebSocketChannelProvider.Options>?optionsBuilder = null)
 {
     services.TryAddSingleton(c => {
         var options = new WebSocketChannelProvider.Options();
         optionsBuilder?.Invoke(c, options);
         return(options);
     });
     services.TryAddSingleton <IChannelProvider, WebSocketChannelProvider>();
     return(services.AddFusionClientCore().AddRestEaseCore());
 }
Пример #6
0
        public FusionRestEaseClientBuilder ConfigureWebSocketChannel(
            Action <IServiceProvider, WebSocketChannelProvider.Options> optionsBuilder)
        {
            var serviceDescriptor = new ServiceDescriptor(
                typeof(WebSocketChannelProvider.Options),
                c => {
                var options = new WebSocketChannelProvider.Options();
                optionsBuilder.Invoke(c, options);
                return(options);
            },
                ServiceLifetime.Singleton);

            Services.Replace(serviceDescriptor);
            return(this);
        }
        // Common client-side services

        public static IServiceCollection AddFusionWebSocketClient(
            this IServiceCollection services,
            WebSocketChannelProvider.Options options)
        => services
        .AddRestEaseCore()
        .AddFusionWebSocketClientCore(options);