EventHub.Microsoft.Extensions.DependencyInjection 1.0.0

dotnet add package EventHub.Microsoft.Extensions.DependencyInjection --version 1.0.0                
NuGet\Install-Package EventHub.Microsoft.Extensions.DependencyInjection -Version 1.0.0                
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="EventHub.Microsoft.Extensions.DependencyInjection" Version="1.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add EventHub.Microsoft.Extensions.DependencyInjection --version 1.0.0                
#r "nuget: EventHub.Microsoft.Extensions.DependencyInjection, 1.0.0"                
#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.
// Install EventHub.Microsoft.Extensions.DependencyInjection as a Cake Addin
#addin nuget:?package=EventHub.Microsoft.Extensions.DependencyInjection&version=1.0.0

// Install EventHub.Microsoft.Extensions.DependencyInjection as a Cake Tool
#tool nuget:?package=EventHub.Microsoft.Extensions.DependencyInjection&version=1.0.0                

EventHub.Microsoft.Extensions.DependencyInjection

Last Version : 1.0.0 Last Commit : April 2024 License

Introduction

This NuGet package facilitates integration of the EventHub library with Microsoft.Extensions.DependencyInjection for dependency injection in .NET applications.

Table of Contents

<a id="installation"/> Installation

<a id="installcli"/> Using .NET CLI

Install this package via .NET CLI:

dotnet add package EventHub.Microsoft.Extensions.DependencyInjection --version 1.0.0

<a id="installnugetpackage"/> Using NuGet Package Manager Console

If you prefer using the NuGet Package Manager Console, you can execute the following command:

Install-Package EventHub.Microsoft.Extensions.DependencyInjection -Version 1.0.0

<a id="usage"/> Usage

<a id="registering"/> Signal Registration

Register the EventHub services with specific interfaces for dependency injection:

Registering

You can register new event signals dynamically using the Register<TSignal> method. This method takes a type parameter TSignal, which represents the event signal to be registered.

services.AddEventHub(configuration =>
{
    configuration.Register<ExampleSignal>(); // Replace ExampleSignal with your signal type
});

After registering an event signal, you can subscribe, unsubscribe, and fire events using that signal.

In this example, ExampleSignal is unregistered from the EventBus instance bus. The UnRegister<TSignal> method is useful for dynamically managing the set of event signals that the EventBus instance is configured to handle.

<a id="resolving"/> Resolving Event Bus

Once registered, you can resolve the EventHub services through their respective interfaces:

using EventHub;

public class MyService
{
    private readonly ISignalManager _signalManager;
    private readonly ISubscriptionManager _subscriptionManager;
    private readonly IFireManager _fireManager;

    public MyService(ISignalManager signalManager, ISubscriptionManager subscriptionManager, IFireManager fireManager)
    {
        _signalManager = signalManager;
        _subscriptionManager = subscriptionManager;
        _fireManager = fireManager;
    }

    public void UseEventHub()
    {
        // Use the resolved interfaces to interact with EventHub functionality
        _signalManager.Register<ExampleSignal>();
        _subscriptionManager.Subscribe<ExampleSignal>(HandleSignal);
        _fireManager.Fire<ExampleSignal>();
    }

    private void HandleSignal(ExampleSignal signal)
    {
        // Handle the received signal
    }
}

<a id="resolving"/> Available Interfaces

The EventBus instance can be accessed via the following interfaces:

  • IBus: Represents the main EventHub bus.
  • ISignalManager: Provides methods to register and unregister signals.
  • ISubscriptionManager: Offers methods to subscribe and unsubscribe from signals.
  • IFireManager: Enables firing signals synchronously and asynchronously.

Each interface provides specific functionalities to interact with the EventHub framework within your application.

<a id="additional"/> Additional Notes

Make sure to replace ExampleSignal with your custom signal type that implements the IEvent interface from EventHub. For more detailed usage examples and documentation, refer to the EventHub GitHub repository.

<a id="contributing"/> Contributing

Contributions to the EventBus repository are welcome! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request on the GitHub repository.

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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. 
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
1.0.0 158 4/6/2024 1.0.0 is deprecated because it is no longer maintained.