HaidaiTech.Notificator 2.0.0

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

// Install HaidaiTech.Notificator as a Cake Tool
#tool nuget:?package=HaidaiTech.Notificator&version=2.0.0                

Haidai Notificator

Haidai Notificator is a project developed by the Haidai team, implementing the Notification Pattern as described by Martin Fowler here.

Release Versions

  • 1.0.0: The inaugural version of HaidaiTech.Notificator.
  • 1.0.1: Updated the .NET framework to version 6, addressing several bugs in the process.
  • 1.1.1: Correcting version format.

Release Notes

Version 1.2.1

This version introduces enhanced flexibility to the NotificationContextMessage. You can now define your preferred level of notification criticality. Implementation details can be found in the tests.

Two development helpers have been introduced:

  • NotificationContextErrorLevelHelper: This class encompasses various error level codes. If additional Error Level Codes are necessary, feel free to extend the NotificationContextErrorLevelHelper (refer to the test project).
  • NotificatorErrorCodesHelper: This class contains 100 Error Codes. For those requiring more Error Codes, it's possible to extend the NotificatorErrorCodesHelper (see the test project).

It's worth noting that during the use of FluentValidator, the code in the test project might appear inelegant when transferring data from FluentValidator to HaidaiTech.Notificator.

Version 1.3.1

This version enhances flexibility in the NotificationContext class. You are now empowered to insert a single message or a list of messages, and the Notification Class will create a single NotificationContextMessage for each message. Implementation details are available in the tests, specifically in the methods ShouldAddSingleMessageInNotificationContext, ShouldAddSingleMessageInNotificationContextAsync, ShouldAddListOfStringToNotificationContext, and ShouldAddListOfStringToNotificationContextAsync.

Version 2.0.0

This version further enhances flexibility in the NotificationContext class. You can now create your own notification context message or continue using NotificationContextMessage. This flexibility was recognized when using the notification context in a legacy project, where the Context Message had specific fields like CreatedAt and Machine Name. Another improvement is the removal of a dependency in NotificationContextMessage. It's now corrected.

We deemed it better to keep the library in .NET Standard 2.1 and keep it updated for .NET version 8.

Demonstration

// All methods now need an implementation of INotificationContextMessage

var notificationContext = new NotificationContext<NotificationContextMessage>();

notificationContext.AddNotification(
    new NotificationContextMessage(
        "A normal notification",
        "errorLevel",
        "errorCode"
    )
);

In projects using a dependency injection container, it is necessary to register the INotificationContext interface by passing the NotificationContextMessage that you intend to use. See SamplesAPI in the samples directory.

// The library provides NotificationContextMessage. You can use it if you want.
builder.Services.AddScoped<INotificationContext<NotificationContextMessage>, NotificationContext<NotificationContextMessage>>();

// Or you can create your own Notification Context message
public class MyOwnNotificationContextMessage : INotificationContextMessage
{
    public DateTime CreatedAt { get; private set; }
    public string MachineName { get; private set; }
    public string Message { get; private set; }
    public string ErrorLevel { get; private set; }
    public string ErrorCode { get; private set; }

    public MyOwnNotificationContextMessage(
        DateTime createdAt,
        string machineName,
        string message,
        string errorLevel,
        string errorCode
    )
    {
        CreatedAt = createdAt;
        MachineName = machineName;
        Message = message;
        ErrorLevel = errorLevel;
        ErrorCode = errorCode;
    }
}

This class needs to implement INotificationContextMessage, and in the container, you must declare

builder.Services.AddScoped<INotificationContext<MyOwnNotificationContextMessage>, NotificationContext<MyOwnNotificationContextMessage>>();
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  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 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. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.1

    • No dependencies.
  • net8.0

    • No dependencies.

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
3.0.0 104 9/11/2024
2.1.0 147 2/10/2024
2.0.0 181 12/25/2023
1.3.1 144 8/27/2023
1.2.1 146 8/19/2023
1.1.1 128 8/19/2023
1.0.1 142 8/15/2023
1.0.0 142 8/10/2023