| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- using System;
- using System.ComponentModel.DataAnnotations;
- using System.ComponentModel.DataAnnotations.Schema;
- using Abp.Domain.Entities;
- using Abp.Domain.Entities.Auditing;
- using Abp.Json;
- namespace Abp.Notifications
- {
- /// <summary>
- /// Used to store a notification subscription.
- /// </summary>
- [Table("AbpNotificationSubscriptions")]
- public class NotificationSubscriptionInfo : CreationAuditedEntity<Guid>, IMayHaveTenant
- {
- /// <summary>
- /// Tenant id of the subscribed user.
- /// </summary>
- public virtual int? TenantId { get; set; }
- /// <summary>
- /// User Id.
- /// </summary>
- public virtual long UserId { get; set; }
- /// <summary>
- /// Notification unique name.
- /// </summary>
- [StringLength(NotificationInfo.MaxNotificationNameLength)]
- public virtual string NotificationName { get; set; }
- /// <summary>
- /// Gets/sets entity type name, if this is an entity level notification.
- /// It's FullName of the entity type.
- /// </summary>
- [StringLength(NotificationInfo.MaxEntityTypeNameLength)]
- public virtual string EntityTypeName { get; set; }
- /// <summary>
- /// AssemblyQualifiedName of the entity type.
- /// </summary>
- [StringLength(NotificationInfo.MaxEntityTypeAssemblyQualifiedNameLength)]
- public virtual string EntityTypeAssemblyQualifiedName { get; set; }
- /// <summary>
- /// Gets/sets primary key of the entity, if this is an entity level notification.
- /// </summary>
- [StringLength(NotificationInfo.MaxEntityIdLength)]
- public virtual string EntityId { get; set; }
- /// <summary>
- /// Initializes a new instance of the <see cref="NotificationSubscriptionInfo"/> class.
- /// </summary>
- public NotificationSubscriptionInfo()
- {
- }
- /// <summary>
- /// Initializes a new instance of the <see cref="NotificationSubscriptionInfo"/> class.
- /// </summary>
- public NotificationSubscriptionInfo(Guid id, int? tenantId, long userId, string notificationName, EntityIdentifier entityIdentifier = null)
- {
- Id = id;
- TenantId = tenantId;
- NotificationName = notificationName;
- UserId = userId;
- EntityTypeName = entityIdentifier == null ? null : entityIdentifier.Type.FullName;
- EntityTypeAssemblyQualifiedName = entityIdentifier == null ? null : entityIdentifier.Type.AssemblyQualifiedName;
- EntityId = entityIdentifier == null ? null : entityIdentifier.Id.ToJsonString();
- }
- }
- }
|