/// <summary>
        /// Add the main reactive services components, including swagger generation
        /// </summary>
        /// <param name="services"></param>
        /// <param name="builderDelegate"></param>
        /// <returns></returns>
        public static IServiceCollection AddReactiveServices(this IServiceCollection services,
                                                             Action <IReactiveServicesBuilder> builderDelegate, ReactiveServicesOption options)
        {
            Options = options;

            // Add reactive services core
            var builder = new ReactiveServicesBuilder();

            builderDelegate(builder);
            services.AddSingleton(builder.Build(services));

            // Optionally, expose reactive services via API
            if (Options.HasFlag(ReactiveServicesOption.WithApi))
            {
                // Routing for mapping HTTP URLs in Kestrel
                services.AddRouting();

                // Swagger generation
                if (Options.HasFlag(ReactiveServicesOption.WithSwagger))
                {
                    services.TryAddSingleton <IApiDescriptionGroupCollectionProvider, ReactiveServicesApiDescriptionGroupProvider>();
                    services.AddSwaggerGen(c =>
                    {
                        c.DocumentFilter <ReactiveServicesApiDescriptionsDocumentFilter>();
                        c.SwaggerDoc("v1", new Info()
                        {
                            Title   = "My Reactive Services",
                            Version = "v1"
                        });
                    });
                }
            }

            return(services);
        }
 public ReactiveServicesOptions(ReactiveServicesOption options)
 {
     Options = options;
 }