VOOZH about

URL: https://www.nuget.org/packages/MakoIoT.Device.Services.Mediator/

⇱ NuGet Gallery | MakoIoT.Device.Services.Mediator 1.0.70.28908




MakoIoT.Device.Services.Mediator 1.0.70.28908

dotnet add package MakoIoT.Device.Services.Mediator --version 1.0.70.28908
 
 
NuGet\Install-Package MakoIoT.Device.Services.Mediator -Version 1.0.70.28908
 
 
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="MakoIoT.Device.Services.Mediator" Version="1.0.70.28908" />
 
 
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MakoIoT.Device.Services.Mediator" Version="1.0.70.28908" />
 
Directory.Packages.props
<PackageReference Include="MakoIoT.Device.Services.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 MakoIoT.Device.Services.Mediator --version 1.0.70.28908
 
 
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: MakoIoT.Device.Services.Mediator, 1.0.70.28908"
 
 
#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 MakoIoT.Device.Services.Mediator@1.0.70.28908
 
 
#: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=MakoIoT.Device.Services.Mediator&version=1.0.70.28908
 
Install as a Cake Addin
#tool nuget:?package=MakoIoT.Device.Services.Mediator&version=1.0.70.28908
 
Install as a Cake Tool
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Mako-IoT.Device.Services.Mediator

Mediator pattern implementation. Provides in-process publisher-subscriber communication while keeping all parties decoupled.

Usage

See Mediator sample

Create classes for your events

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

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

Your event subscriber must implement IEventHandler interface

public class Service2 : IEventHandler
{
 public void Handle(IEvent @event)
 {
 switch (@event)
 {
 case Event1 event1:
 Debug.WriteLine($"[{nameof(Service2)}] Event1 received. The data is: {event1.Data}");
 break;
 case Event2 event2:
 Debug.WriteLine($"[{nameof(Service2)}] Event2 received The text is: {event2.Text}");
 break;
 }
 }
}

Use IMediator to publish events

public class Service1 : IService1
{
 private readonly IMediator _mediator;

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

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

Register Mediator and singleton subscribers in DeviceBuilder

DeviceBuilder.Create()
 .AddMediator(options =>
 {
 options.AddSubscriber(typeof(Event1), typeof(Service2));
 options.AddSubscriber(typeof(Event2), typeof(Service2));
 })
 .Build()
 .Start()

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 Versions Compatible and additional computed target framework versions.
.NET Framework net net is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (4)

Showing the top 4 NuGet packages that depend on MakoIoT.Device.Services.Mediator:

Package Downloads
MakoIoT.Device.Services.ConfigurationManager

Configuration mode manager for MAKO-IoT

MakoIoT.Device.Services.ConfigurationApi

REST API for configuration with MAKO-IoT

MakoIoT.Device.Platform.LocalConfig

MAKO-IoT Platform local configuration library. On-device web server, WiFi AP

MakoIoT.Device.Services.Logging.Storage

Logging to flash storage and logs upload to Elasticsearch for MAKO-IoT

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.70.28908 430 9/28/2025
1.0.69.44310 238 9/27/2025
1.0.68.59455 782 7/16/2025
1.0.67.23572 1,863 4/17/2025
1.0.66.46860 609 4/3/2025
1.0.65.25699 374 4/2/2025
1.0.64.60024 1,056 3/20/2025
1.0.63.14171 590 3/11/2025
1.0.61.19880 1,035 2/27/2025
1.0.60.10419 313 2/26/2025
1.0.59.42289 730 2/20/2025
1.0.58.36645 619 2/18/2025
1.0.57.42352 575 11/28/2024
1.0.56.4697 314 11/27/2024
1.0.55.2648 311 11/26/2024
1.0.54.41107 321 11/25/2024
1.0.53.51021 611 11/19/2024
1.0.52.56154 1,324 10/18/2024
1.0.51.44660 474 10/16/2024
1.0.50.63396 830 9/26/2024
Loading failed