/// <summary> /// Adds a plugin that sends publishes events to different instances of the application /// using an Azure Service Bus topic. /// </summary> /// <param name="pluginOptions">The <see cref="EventsContext"/> options.</param> /// <param name="configuration"> /// A configuration section with the same structure of the <see cref="AzureTopicEventSenderOptions"/> type. /// </param> /// <returns>The same instance of <see cref="IFluentEventsPluginOptions"/> for chaining.</returns> public static IFluentEventsPluginOptions UseAzureTopicEventSender( this IFluentEventsPluginOptions pluginOptions, IConfiguration configuration ) { if (pluginOptions == null) { throw new ArgumentNullException(nameof(pluginOptions)); } pluginOptions.AddPlugin(new AzureTopicEventSenderPlugin(configuration)); return(pluginOptions); }
/// <summary> /// Adds a plugin that receives events published from other instances of the application /// using an Azure Service Bus topic. /// </summary> /// <remarks> /// The management connection string is required to dynamically create topic subscriptions. /// </remarks> /// <param name="pluginOptions">The <see cref="EventsContext"/> options.</param> /// <param name="configureOptions"> /// An <see cref="Action"/> to configure the <see cref="AzureTopicEventReceiverOptions"/> for the receiving plugin. /// </param> /// <returns>The same instance of <see cref="IFluentEventsPluginOptions"/> for chaining.</returns> public static IFluentEventsPluginOptions UseAzureTopicEventReceiver( this IFluentEventsPluginOptions pluginOptions, Action <AzureTopicEventReceiverOptions> configureOptions ) { if (pluginOptions == null) { throw new ArgumentNullException(nameof(pluginOptions)); } pluginOptions.AddPlugin(new AzureTopicEventReceiverPlugin(configureOptions)); return(pluginOptions); }
/// <summary> /// Adds a plugin that attaches the entities tracked by a <see cref="DbContext"/> /// to the <see cref="EventsContext"/> automatically. /// </summary> /// <remarks> /// In order to automatically attach the entities the <see cref="DbContext"/> must be attached /// to the <see cref="EventsContext"/> manually or by using the /// <see cref="FluentEvents.ServiceCollectionExtensions.AddWithEventsAttachedTo{TEventsContext}"/> /// method. (See example) /// </remarks> /// <example> /// services.AddWithEventsAttachedTo<SampleEventsContext>(() => { /// services.AddScoped<MyDbContext>(); /// }); /// /// services.AddEventsContext<SampleEventsContext>(options => { /// options.AttachToDbContextEntities<MyDbContext>(); /// }); /// </example> /// <param name="pluginOptions">The <see cref="EventsContext"/> options.</param> /// <typeparam name="TDbContext">The type of the <see cref="DbContext"/>.</typeparam> /// <returns>The same instance of <see cref="IFluentEventsPluginOptions"/> for chaining.</returns> public static IFluentEventsPluginOptions AttachToDbContextEntities <TDbContext>( this IFluentEventsPluginOptions pluginOptions ) where TDbContext : DbContext { if (pluginOptions == null) { throw new ArgumentNullException(nameof(pluginOptions)); } pluginOptions.AddPlugin(new EntityFrameworkPlugin <TDbContext>()); return(pluginOptions); }
/// <summary> /// Adds a plugin that invokes hub methods on an Azure SignalR Service when events are published. /// </summary> /// <param name="pluginOptions">The <see cref="EventsContext"/> options.</param> /// <param name="configuration"> /// A configuration section with the same structure of the <see cref="AzureSignalRServiceOptions"/> type. /// </param> /// <param name="httpClientBuilder"> /// An <see cref="Action{T}"/> to further configure the <see cref="HttpClient"/> used to make requests to /// the Azure SignalR Service. /// </param> /// <returns>The same instance of <see cref="IFluentEventsPluginOptions"/> for chaining.</returns> public static IFluentEventsPluginOptions UseAzureSignalRService( this IFluentEventsPluginOptions pluginOptions, IConfiguration configuration, Action <IHttpClientBuilder> httpClientBuilder ) { if (pluginOptions == null) { throw new ArgumentNullException(nameof(pluginOptions)); } if (configuration == null) { throw new ArgumentNullException(nameof(configuration)); } pluginOptions.AddPlugin(new AzureSignalRPlugin(configuration, httpClientBuilder)); return(pluginOptions); }