fl-event-handling-extensions 0.1.1

dotnet add package fl-event-handling-extensions --version 0.1.1
                    
NuGet\Install-Package fl-event-handling-extensions -Version 0.1.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="fl-event-handling-extensions" Version="0.1.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="fl-event-handling-extensions" Version="0.1.1" />
                    
Directory.Packages.props
<PackageReference Include="fl-event-handling-extensions" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add fl-event-handling-extensions --version 0.1.1
                    
#r "nuget: fl-event-handling-extensions, 0.1.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package fl-event-handling-extensions@0.1.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=fl-event-handling-extensions&version=0.1.1
                    
Install as a Cake Addin
#tool nuget:?package=fl-event-handling-extensions&version=0.1.1
                    
Install as a Cake Tool

Fl.Event.Handling.Extensions

This library provides dependency injection extensions for registering the event handling components from Fl.Event.Handling into an IServiceCollection.

Components

EventHandlingStrategy

An enum that controls how an event is dispatched to its registered handlers.

Value Description
Sequential Handlers are invoked one at a time, in registration order. Processing stops immediately if any handler returns an error.
Parallel Handlers are invoked concurrently and all are awaited before the result is returned.

ServiceCollectionExtensions

Provides the AddEventHandling<TEvent> extension method on IServiceCollection.

IServiceCollection AddEventHandling<TEvent>(
    this IServiceCollection services,
    EventHandlingStrategy strategy,
    Assembly assembly)
    where TEvent : class

This method:

  1. Registers an IEventProcessor<TEvent> singleton — either SequentialEventProcessor<TEvent> or ParallelEventProcessor<TEvent> — depending on the chosen strategy.
  2. Scans the provided assembly and registers all concrete IEventHandler<TEvent> implementations as singleton services.

An ArgumentException is thrown if strategy is not a valid EventHandlingStrategy value.


Usage

using Fl.Event.Handling.Extensions;
using System.Reflection;

// Inside your IServiceCollection configuration (e.g. Program.cs or a startup class):
services.AddEventHandling<MyEvent>(
    EventHandlingStrategy.Sequential,
    Assembly.GetExecutingAssembly());

To use the parallel strategy instead:

services.AddEventHandling<MyEvent>(
    EventHandlingStrategy.Parallel,
    Assembly.GetExecutingAssembly());

Multiple event types can be registered independently:

services.AddEventHandling<OrderPlacedEvent>(EventHandlingStrategy.Sequential, Assembly.GetExecutingAssembly());
services.AddEventHandling<PaymentReceivedEvent>(EventHandlingStrategy.Parallel, Assembly.GetExecutingAssembly());

Each call scans the assembly for the corresponding IEventHandler<TEvent> implementations and registers them alongside their processor.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.1 304 5/4/2026