CCSWE.nanoFramework.Mediator 1.1.68

There is a newer version of this package available.
See the version list below for details.
dotnet add package CCSWE.nanoFramework.Mediator --version 1.1.68
                    
NuGet\Install-Package CCSWE.nanoFramework.Mediator -Version 1.1.68
                    
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.68" />
                    
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.68" />
                    
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.68
                    
#r "nuget: CCSWE.nanoFramework.Mediator, 1.1.68"
                    
#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.68
                    
#: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.68
                    
Install as a Cake Addin
#tool nuget:?package=CCSWE.nanoFramework.Mediator&version=1.1.68
                    
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.84 112 10/3/2025
1.1.83 191 7/7/2025
1.1.82 313 6/9/2025
1.1.81 310 6/9/2025
1.1.79 170 4/29/2025
1.1.78 189 4/28/2025
1.1.77 206 4/24/2025
1.1.75 243 4/17/2025
1.1.74 217 4/2/2025
1.1.73 184 3/26/2025
1.1.72 202 3/19/2025
1.1.71 150 3/14/2025
1.1.69 218 3/11/2025
1.1.68 224 3/11/2025
1.1.67 264 3/6/2025
1.1.66 277 3/3/2025
1.1.65 177 2/27/2025
1.1.64 149 2/26/2025
1.1.63 153 2/10/2025
1.1.62 159 2/10/2025
1.1.61 164 2/10/2025
1.1.56 144 2/7/2025
1.1.55 151 2/7/2025
1.1.54 152 2/7/2025
1.1.53 146 2/6/2025
1.1.52 156 2/6/2025
1.1.51 157 2/6/2025
1.1.50 147 2/6/2025
1.1.49 153 2/6/2025
1.1.48 148 2/5/2025
1.1.47 145 2/5/2025
1.1.46 146 2/5/2025
1.1.45 157 2/4/2025
1.1.44 155 2/4/2025
1.1.43 159 2/4/2025
1.1.42 155 2/4/2025
1.1.41 148 2/3/2025
1.1.40 148 2/3/2025
1.1.39 134 2/3/2025
1.1.37 150 2/3/2025
1.1.36 155 2/2/2025
1.1.35 150 2/2/2025
1.1.33 155 2/2/2025
1.1.29 157 1/31/2025
1.1.27 142 1/17/2025
1.1.24 135 1/17/2025
1.1.22 149 1/13/2025
1.1.21 141 1/12/2025
1.1.20 144 1/12/2025
1.1.19 143 1/12/2025
1.1.18 147 1/11/2025
1.1.17 141 1/11/2025
1.0.79 156 1/10/2025
1.0.78 149 1/9/2025
1.0.77 159 1/2/2025
1.0.76 152 12/26/2024
1.0.75 149 12/19/2024
1.0.74 195 12/12/2024
1.0.73 157 12/5/2024
1.0.72 163 11/28/2024
1.0.71 141 10/31/2024
1.0.70 155 10/24/2024
1.0.69 161 10/10/2024
1.0.68 154 10/3/2024
1.0.67 156 9/26/2024
1.0.66 156 9/23/2024
1.0.65 148 9/22/2024
1.0.64 153 9/21/2024
1.0.63 174 9/21/2024
1.0.62 199 9/14/2024
1.0.61 182 9/13/2024
1.0.59 164 9/2/2024
1.0.58 167 9/1/2024
1.0.57 162 8/31/2024
1.0.56 162 8/31/2024
1.0.55 189 8/14/2024
1.0.54 178 8/13/2024
1.0.53 176 8/11/2024
1.0.52 158 8/11/2024
1.0.51 176 8/8/2024
1.0.50 163 8/7/2024
1.0.49 178 8/6/2024
1.0.48 148 8/4/2024
1.0.47 150 8/3/2024
1.0.46 154 8/2/2024
1.0.45 147 8/2/2024
1.0.44 151 7/29/2024
1.0.43 139 7/27/2024
1.0.42 151 7/26/2024
1.0.41 151 7/25/2024
1.0.40 158 7/24/2024
1.0.39 174 7/19/2024
1.0.38 167 7/17/2024
1.0.37 160 7/15/2024
1.0.36 156 7/14/2024
1.0.35 173 7/13/2024
1.0.34 167 7/12/2024
1.0.33 189 6/16/2024
1.0.32 169 6/14/2024
1.0.31 166 6/13/2024
1.0.27 177 6/7/2024
1.0.26 173 6/6/2024
1.0.25 168 6/5/2024
1.0.24 168 6/5/2024
1.0.22 174 5/25/2024
1.0.21 173 5/24/2024
1.0.20 164 5/23/2024
1.0.19 176 5/21/2024
1.0.18 178 5/20/2024
1.0.17 167 5/19/2024
1.0.16 180 5/19/2024
1.0.15 178 5/19/2024
1.0.14 176 5/18/2024
1.0.12 170 5/16/2024
1.0.11 180 5/15/2024
1.0.10 160 5/13/2024
1.0.9 169 5/11/2024
1.0.8 162 5/10/2024
1.0.7 171 4/27/2024
1.0.6 173 4/26/2024
1.0.5 174 4/25/2024
1.0.4 172 4/25/2024
1.0.3 190 4/23/2024
1.0.2 183 4/20/2024
1.0.1 183 4/19/2024
1.0.0 185 4/19/2024
0.3.31 166 4/17/2024
0.3.30 188 4/13/2024
0.3.29 149 4/12/2024
0.3.28 179 4/11/2024
0.3.27 163 4/10/2024
0.3.26 175 4/9/2024
0.3.25 182 4/8/2024
0.3.24 161 4/7/2024
0.3.23 186 4/6/2024
0.3.22 175 4/5/2024
0.3.21 169 4/4/2024
0.3.20 163 4/3/2024
0.3.19 183 3/24/2024
0.3.18 187 3/22/2024
0.3.17 160 3/21/2024
0.3.16 215 2/6/2024
0.3.15 176 2/3/2024
0.3.14 176 2/1/2024
0.3.13 165 1/27/2024
0.3.12 169 1/26/2024
0.3.11 283 11/23/2023
0.3.10 178 11/22/2023
0.3.9 183 11/21/2023
0.3.8 197 11/17/2023
0.3.7 201 11/14/2023
0.3.6 178 11/13/2023
0.3.5 184 11/12/2023
0.3.4 178 11/12/2023
0.3.3 175 11/12/2023
0.3.2 170 11/12/2023
0.3.1 192 11/10/2023
0.3.0 178 11/10/2023
0.2.14 188 11/9/2023
0.2.13 191 11/8/2023
0.2.12 179 11/7/2023
0.2.10 194 11/7/2023
0.2.9 232 11/6/2023
0.2.7 237 11/6/2023
0.2.6 193 11/4/2023
0.2.5 196 11/3/2023
0.2.4 191 11/2/2023
0.2.3 189 11/2/2023
0.2.2 187 11/2/2023
0.2.1 188 10/30/2023
0.2.0 180 10/30/2023
0.1.8 198 10/28/2023
0.1.7 197 10/24/2023
0.1.6 198 10/24/2023
0.1.5 216 10/24/2023
0.1.4 209 10/24/2023
0.1.3 200 10/20/2023
0.1.2-beta 197 10/20/2023
0.1.1-beta 182 10/20/2023