CCSWE.nanoFramework.Mediator 1.1.86

dotnet add package CCSWE.nanoFramework.Mediator --version 1.1.86
                    
NuGet\Install-Package CCSWE.nanoFramework.Mediator -Version 1.1.86
                    
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="CCSWE.nanoFramework.Mediator" Version="1.1.86" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CCSWE.nanoFramework.Mediator" Version="1.1.86" />
                    
Directory.Packages.props
<PackageReference Include="CCSWE.nanoFramework.Mediator" />
                    
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 CCSWE.nanoFramework.Mediator --version 1.1.86
                    
#r "nuget: CCSWE.nanoFramework.Mediator, 1.1.86"
                    
#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 CCSWE.nanoFramework.Mediator@1.1.86
                    
#: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=CCSWE.nanoFramework.Mediator&version=1.1.86
                    
Install as a Cake Addin
#tool nuget:?package=CCSWE.nanoFramework.Mediator&version=1.1.86
                    
Install as a Cake Tool

Build License NuGet

CCSWE.nanoFramework.Mediator

A simple asynchronous mediator implementation for nanoFramework. Provides in-process publisher-subscriber communication while keeping all parties decoupled.

Based on Mako-IoT.Device.Services.Mediator

Usage

Create classes for your events

public class Event1 : IMediatorEvent
{
    public string Data { get; set; }
}

public class Event2 : IMediatorEvent
{
    public string Text { get; set; }
}

Your event subscriber must implement IMediatorEventHandler interface

public class EventHandlerService : IMediatorEventHandler
{
    public void HandleEvent(IMediatorEvent mediatorEvent)
    {
        switch (mediatorEvent)
        {
            case Event1 event1:
                Debug.WriteLine($"[{nameof(EventHandlerService)}] Event1 received. The data is: {event1.Data}");
                break;
            case Event2 event2:
                Debug.WriteLine($"[{nameof(EventHandlerService)}] Event2 received The text is: {event2.Text}");
                break;
        }
    }
}

Use IMediator to publish events

public class EventPublisherService : IEventPublisherService
{
    private readonly IMediator _mediator;

    public EventPublisherService(IMediator mediator)
    {
        _mediator = mediator;
    }

    public void DoSomething()
    {
        _mediator.Publish(new Event2 { Text = "Hello from EventPublisherService" });
    }
}

Register AsyncMediator and singleton subscribers to an IHostBuilder ...

    var hostBuilder = new HostBuilder();
    hostBuilder.UseMediator(options =>
    {
        options.AddSubscriber(typeof(Event1), typeof(Service2));
        options.AddSubscriber(typeof(Event2), typeof(Service2));
    });

... or directly to an IServiceCollection

    var serviceCollection = new ServiceCollection();
    serviceCollection.AddMediator(options =>
    {
        options.AddSubscriber(typeof(Event1), typeof(Service2));
        options.AddSubscriber(typeof(Event2), typeof(Service2));
    });

For transient and scoped services you can use the Subscribe and Unsubscribe overloads that take a specific instance.

public class TransientService : IDisposable
{
    private readonly IMediator _mediator;

    public TransientService(IMediator mediator)
    {
        _mediator = mediator;
        _mediator.Subscribe(typeof(Event1), this);
        _mediator.Subscribe(typeof(Event2), this);
    }

    public void Dispose()
    {
        _mediator.Unsubscribe(typeof(Event1), this);
        _mediator.Unsubscribe(typeof(Event2), this);
    }
}
Product Compatible and additional computed target framework versions.
.NET Framework net is compatible. 
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.1.86 181 11/6/2025
1.1.84 128 10/3/2025
1.1.83 202 7/7/2025
1.1.82 325 6/9/2025
1.1.81 320 6/9/2025
1.1.79 179 4/29/2025
1.1.78 202 4/28/2025
1.1.77 213 4/24/2025
1.1.75 254 4/17/2025
1.1.74 227 4/2/2025
1.1.73 194 3/26/2025
1.1.72 211 3/19/2025
1.1.71 159 3/14/2025
1.1.69 227 3/11/2025
1.1.68 233 3/11/2025
1.1.67 275 3/6/2025
1.1.66 290 3/3/2025
1.1.65 185 2/27/2025
1.1.64 159 2/26/2025
1.1.63 163 2/10/2025
1.1.62 167 2/10/2025
1.1.61 173 2/10/2025
1.1.56 153 2/7/2025
1.1.55 165 2/7/2025
1.1.54 161 2/7/2025
1.1.53 154 2/6/2025
1.1.52 165 2/6/2025
1.1.51 165 2/6/2025
1.1.50 155 2/6/2025
1.1.49 161 2/6/2025
1.1.48 157 2/5/2025
1.1.47 153 2/5/2025
1.1.46 155 2/5/2025
1.1.45 164 2/4/2025
1.1.44 162 2/4/2025
1.1.43 168 2/4/2025
1.1.42 165 2/4/2025
1.1.41 158 2/3/2025
1.1.40 158 2/3/2025
1.1.39 141 2/3/2025
1.1.37 159 2/3/2025
1.1.36 163 2/2/2025
1.1.35 156 2/2/2025
1.1.33 162 2/2/2025
1.1.29 166 1/31/2025
1.1.27 150 1/17/2025
1.1.24 142 1/17/2025
1.1.22 156 1/13/2025
1.1.21 147 1/12/2025
1.1.20 151 1/12/2025
1.1.19 151 1/12/2025
1.1.18 154 1/11/2025
1.1.17 148 1/11/2025
1.0.79 165 1/10/2025
1.0.78 156 1/9/2025
1.0.77 167 1/2/2025
1.0.76 159 12/26/2024
1.0.75 157 12/19/2024
1.0.74 203 12/12/2024
1.0.73 164 12/5/2024
1.0.72 171 11/28/2024
1.0.71 149 10/31/2024
1.0.70 165 10/24/2024
1.0.69 167 10/10/2024
1.0.68 164 10/3/2024
1.0.67 166 9/26/2024
1.0.66 165 9/23/2024
1.0.65 157 9/22/2024
1.0.64 162 9/21/2024
1.0.63 187 9/21/2024
1.0.62 211 9/14/2024
1.0.61 189 9/13/2024
1.0.59 177 9/2/2024
1.0.58 173 9/1/2024
1.0.57 173 8/31/2024
1.0.56 170 8/31/2024
1.0.55 199 8/14/2024
1.0.54 185 8/13/2024
1.0.53 184 8/11/2024
1.0.52 167 8/11/2024
1.0.51 186 8/8/2024
1.0.50 171 8/7/2024
1.0.49 187 8/6/2024
1.0.48 154 8/4/2024
1.0.47 157 8/3/2024
1.0.46 164 8/2/2024
1.0.45 153 8/2/2024
1.0.44 162 7/29/2024
1.0.43 148 7/27/2024
1.0.42 164 7/26/2024
1.0.41 160 7/25/2024
1.0.40 166 7/24/2024
1.0.39 181 7/19/2024
1.0.38 176 7/17/2024
1.0.37 169 7/15/2024
1.0.36 163 7/14/2024
1.0.35 180 7/13/2024
1.0.34 176 7/12/2024
1.0.33 195 6/16/2024
1.0.32 177 6/14/2024
1.0.31 175 6/13/2024
1.0.27 184 6/7/2024
1.0.26 182 6/6/2024
1.0.25 175 6/5/2024
1.0.24 178 6/5/2024
1.0.22 181 5/25/2024
1.0.21 182 5/24/2024
1.0.20 175 5/23/2024
1.0.19 184 5/21/2024
1.0.18 187 5/20/2024
1.0.17 174 5/19/2024
1.0.16 188 5/19/2024
1.0.15 187 5/19/2024
1.0.14 184 5/18/2024
1.0.12 180 5/16/2024
1.0.11 191 5/15/2024
1.0.10 167 5/13/2024
1.0.9 177 5/11/2024
1.0.8 171 5/10/2024
1.0.7 177 4/27/2024
1.0.6 181 4/26/2024
1.0.5 184 4/25/2024
1.0.4 180 4/25/2024
1.0.3 198 4/23/2024
1.0.2 192 4/20/2024
1.0.1 191 4/19/2024
1.0.0 193 4/19/2024
0.3.31 174 4/17/2024
0.3.30 195 4/13/2024
0.3.29 160 4/12/2024
0.3.28 188 4/11/2024
0.3.27 173 4/10/2024
0.3.26 183 4/9/2024
0.3.25 190 4/8/2024
0.3.24 170 4/7/2024
0.3.23 193 4/6/2024
0.3.22 182 4/5/2024
0.3.21 177 4/4/2024
0.3.20 171 4/3/2024
0.3.19 191 3/24/2024
0.3.18 195 3/22/2024
0.3.17 170 3/21/2024
0.3.16 223 2/6/2024
0.3.15 184 2/3/2024
0.3.14 182 2/1/2024
0.3.13 174 1/27/2024
0.3.12 179 1/26/2024
0.3.11 285 11/23/2023
0.3.10 183 11/22/2023
0.3.9 187 11/21/2023
0.3.8 200 11/17/2023
0.3.7 206 11/14/2023
0.3.6 184 11/13/2023
0.3.5 192 11/12/2023
0.3.4 182 11/12/2023
0.3.3 180 11/12/2023
0.3.2 175 11/12/2023
0.3.1 200 11/10/2023
0.3.0 184 11/10/2023
0.2.14 191 11/9/2023
0.2.13 193 11/8/2023
0.2.12 183 11/7/2023
0.2.10 198 11/7/2023
0.2.9 234 11/6/2023
0.2.7 242 11/6/2023
0.2.6 198 11/4/2023
0.2.5 199 11/3/2023
0.2.4 196 11/2/2023
0.2.3 193 11/2/2023
0.2.2 189 11/2/2023
0.2.1 191 10/30/2023
0.2.0 182 10/30/2023
0.1.8 205 10/28/2023
0.1.7 201 10/24/2023
0.1.6 202 10/24/2023
0.1.5 222 10/24/2023
0.1.4 215 10/24/2023
0.1.3 205 10/20/2023
0.1.2-beta 203 10/20/2023
0.1.1-beta 186 10/20/2023