Levge.Notification 2.3.0

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

Publish NuGet Package

Levge.Notification

Email, push ve anlık bildirim altyapısı. SMTP ve SendGrid desteği, RazorLight tabanlı HTML template render motoru ve genişletilebilir INotificationService soyutlaması. İleride Firebase push notification, SignalR gibi kanallar eklenebilir.

Kurulum

dotnet add package Levge.Notification

İçerik

Sınıf / Interface Açıklama
INotificationService Üst seviye bildirim sözleşmesi (SendEmailAsync)
IEmailSender Email gönderme alt seviye sözleşmesi
EmailMessage Email mesaj DTO (To, Subject, TemplateName, Model)
SmtpEmailSender MailKit tabanlı SMTP implementasyonu
SendGridEmailSender SendGrid HTTP API implementasyonu
RazorTemplateRenderer RazorLight ile .cshtml template render motoru
EmailConfig SMTP + SendGrid konfigürasyon sınıfları
WelcomeEmailModel WelcomeEmail.cshtml için view model
ForgotPasswordModel ForgotPassword.cshtml için view model

Kullanım

DI Kaydı

services.AddLevgeNotification(configuration);

appsettings.json:

{
  "Email": {
    "Provider": "Smtp",
    "Smtp": {
      "Host": "localhost",
      "Port": 1025,
      "From": "noreply@example.com",
      "FromName": "MyApp"
    }
  }
}

Provider değerini "SendGrid" yaparak SendGrid'e geçebilirsiniz:

{
  "Email": {
    "Provider": "SendGrid",
    "SendGrid": {
      "ApiKey": "SG.xxx",
      "From": "noreply@example.com",
      "FromName": "MyApp"
    }
  }
}

Email Gönderme

public class UserRegisteredEventHandler : INotificationHandler<DomainEventNotification<UserRegisteredEvent>>
{
    private readonly INotificationService _notifications;

    public UserRegisteredEventHandler(INotificationService notifications)
    {
        _notifications = notifications;
    }

    public async Task Handle(DomainEventNotification<UserRegisteredEvent> notification, CancellationToken cancellationToken)
    {
        var evt = notification.Event;

        await _notifications.SendEmailAsync(new EmailMessage
        {
            To = evt.Email,
            ToName = evt.FirstName,
            Subject = $"Welcome to {evt.TenantName}!",
            TemplateName = "WelcomeEmail",
            Model = new WelcomeEmailModel
            {
                FirstName = evt.FirstName,
                Email = evt.Email,
                TenantName = evt.TenantName
            }
        }, cancellationToken);
    }
}

Özel Template Ekleme

  1. Email/Templates/ klasörüne MyEmail.cshtml ekle
  2. @model direktifinde kendi model sınıfını kullan
  3. TemplateName = "MyEmail" ile çağır

Lisans

MIT © Serdar ÖZKAN

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
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
2.3.0 93 4/29/2026
2.2.0 96 4/29/2026
2.1.0 95 4/27/2026
2.0.1 94 4/27/2026
1.0.0 115 1/23/2026