Micky5991.EventAggregator 3.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Micky5991.EventAggregator --version 3.0.0                
NuGet\Install-Package Micky5991.EventAggregator -Version 3.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="Micky5991.EventAggregator" Version="3.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Micky5991.EventAggregator --version 3.0.0                
#r "nuget: Micky5991.EventAggregator, 3.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 Micky5991.EventAggregator as a Cake Addin
#addin nuget:?package=Micky5991.EventAggregator&version=3.0.0

// Install Micky5991.EventAggregator as a Cake Tool
#tool nuget:?package=Micky5991.EventAggregator&version=3.0.0                

EventAggregator

This library implements a variation of the eventaggregator pattern.

Features

  • Event cancelling
  • Subscription priorites
  • Dispatching in specified threads

NuGet Package

This library is also available as .NET 8.0 / .NET 9.0 library from NuGet.

PM> Install-Package Micky5991.EventAggregator

Getting Started

Requirements

Registration

In order to use this library, you need to first register the IEventAggregator to your IServiceCollection.

return new ServiceCollection()

    .AddSingleton<IEventAggregator, EventAggregatorService>() // Add this line to your registration chain...
    .AddScoped<IEventAggregator, EventAggregatorService>() // ... or this one if you want to scope it

    .BuildServiceProvider();

Create your first event

All have to implement the interface Micky5991.EventAggregator.Interfaces.IEvent.

Simple events

To create your first event you just have to inherit from the abstract class Micky5991.EventAggregator.Elements.EventBase.

Data changing events

Data changing events implement the interface Micky5991.EventAggregator.Interfaces.IDataChangingEvent and prevent any subscribers to subscribe from other ThreadTargets than PublishersThread.

Cancellable events

Cancellable events implement Micky5991.EventAggregator.Interfaces.ICancellableEvent which enable cancellation for other handlers and to react after the publish by the publisher.

All rules from the data changing events also apply.

To create cancellable event you just have to inherit from the abstract class Micky5991.EventAggregator.Elements.CancellableEventBase.

Example

You can find a sample project in here.

License

MIT License

Copyright (c) 2022-2024 Micky5991

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Micky5991.EventAggregator:

Package Downloads
Micky5991.Samp.Net.Core

Provides core functionality and interop utilities for the native SA:MP plugin.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
3.0.1 90 12/4/2024
3.0.0 96 11/14/2024
2.4.1 2,173 3/6/2023
2.3.1 436 10/2/2022
2.2.0 400 9/18/2021
2.1.0 407 2/23/2021
2.0.2 724 1/30/2021
2.0.1 732 1/9/2021
2.0.0 397 1/9/2021
1.2.2 372 1/4/2021
1.2.0 540 3/28/2020
1.1.1 542 3/28/2020
1.1.0 558 11/24/2019
1.0.1 502 11/24/2019