这是基于vue-vben-admin 模板适用于abp Vnext的前端管理项目
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
feijie f60b0b8320 feat(docs): 添加实时通知模块文档 1 year ago
..
LINGYUN/Abp/Notifications upgrade abp framework to 8.2.0 2 years ago
Volo/Abp upgrade abp framework to 8.2.0 2 years ago
FodyWeavers.xml upgrade(abp): upgrade abp framework to 7.4.0 2 years ago
FodyWeavers.xsd upgrade(abp): upgrade abp framework to 7.4.0 2 years ago
LINGYUN.Abp.Notifications.Common.csproj upgrade abp framework to 8.2.0 2 years ago
README.EN.md feat(docs): 添加实时通知模块文档 1 year ago
README.md feat(docs): 添加实时通知模块文档 1 year ago

README.md

LINGYUN.Abp.Notifications.Common

通知系统的公共模块,提供了通知系统的基础定义和共享功能。

功能特性

  • 通知定义
    • 通知组定义
    • 通知类型定义
    • 通知级别定义
  • 通用工具类
    • 通知数据处理
    • 通知状态管理
  • 扩展功能
    • 通知数据扩展
    • 通知提供者扩展

模块引用

[DependsOn(typeof(AbpNotificationsCommonModule))]
public class YouProjectModule : AbpModule
{
  // other
}

基础定义

通知组

public class NotificationGroupDefinition
{
    public string Name { get; }
    public string DisplayName { get; }
    public string Description { get; }
    public bool AllowSubscriptionToClients { get; }
}

通知定义

public class NotificationDefinition
{
    public string Name { get; }
    public string DisplayName { get; }
    public string Description { get; }
    public NotificationType NotificationType { get; }
    public NotificationLifetime Lifetime { get; }
    public bool AllowSubscriptionToClients { get; }
}

基本用法

  1. 定义通知组
public class YourNotificationGroupDefinitionProvider : NotificationGroupDefinitionProvider
{
    public override void Define(INotificationGroupDefinitionContext context)
    {
        context.Add(
            new NotificationGroupDefinition(
                name: "App.Notifications",
                displayName: L("AppNotifications"),
                description: L("AppNotificationsDescription")
            )
        );
    }
}
  1. 定义通知
public class YourNotificationDefinitionProvider : NotificationDefinitionProvider
{
    public override void Define(INotificationDefinitionContext context)
    {
        context.Add(
            new NotificationDefinition(
                name: "App.NewMessage",
                displayName: L("NewMessage"),
                description: L("NewMessageDescription"),
                notificationType: NotificationType.Application,
                lifetime: NotificationLifetime.Persistent
            )
        );
    }
}
  1. 使用通知数据扩展
public static class NotificationDataExtensions
{
    public static void SetTitle(this NotificationData data, string title)
    {
        data.ExtraProperties["Title"] = title;
    }

    public static string GetTitle(this NotificationData data)
    {
        return data.ExtraProperties.GetOrDefault("Title") as string;
    }
}

更多信息