SimpleNotify is a lightweight and minimal notification library for .NET, inspired by the notification pattern in MediatR.
It allows you to raise and handle notifications (also known as events) across your application layers — without the overhead.
- 🟢 Lightweight, minimal API
- 🧩 Decoupled notification handling
- ⚡ Fast and dependency-free
- 🧠 Familiar
INotificationinterface
Install via NuGet:
dotnet add package SimpleNotifyInstall via NuGet:
dotnet add package SimpleNotify🚀 Usage
builder.Services.AddSimpleNotify(typeof(Program).Assembly);
public record AddOrderNotify(Guid OrderId) : INotification<AddOrderNotify>;
public class AddOrderNotificationHandler : INotificationHandler<AddOrderNotify>
{
public ValueTask Handle(AddOrderNotify notification)
{
Console.WriteLine($"Order {notification.OrderId} has been added");
return ValueTask.CompletedTask;
}
}
Inject the sender service:
private readonly ISimpleNotifySender _simpleNotifySender;
Publish the event:
Guid orderId = Guid.NewGuid();
await _simpleNotifySender.Publish(new AddOrderNotify(orderId));
- Contributions are always welcome!
- Found a bug or have an idea?
- Feel free to open an issue or submit a pull request.