TenantNotificationInfo.cs 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. using System;
  2. using System.ComponentModel.DataAnnotations;
  3. using System.ComponentModel.DataAnnotations.Schema;
  4. using Abp.Domain.Entities;
  5. using Abp.Domain.Entities.Auditing;
  6. namespace Abp.Notifications
  7. {
  8. /// <summary>
  9. /// A notification distributed to it's related tenant.
  10. /// </summary>
  11. [Table("AbpTenantNotifications")]
  12. public class TenantNotificationInfo : CreationAuditedEntity<Guid>, IMayHaveTenant
  13. {
  14. /// <summary>
  15. /// Tenant id of the subscribed user.
  16. /// </summary>
  17. public virtual int? TenantId { get; set; }
  18. /// <summary>
  19. /// Unique notification name.
  20. /// </summary>
  21. [Required]
  22. [StringLength(NotificationInfo.MaxNotificationNameLength)]
  23. public virtual string NotificationName { get; set; }
  24. /// <summary>
  25. /// Notification data as JSON string.
  26. /// </summary>
  27. [StringLength(NotificationInfo.MaxDataLength)]
  28. public virtual string Data { get; set; }
  29. /// <summary>
  30. /// Type of the JSON serialized <see cref="Data"/>.
  31. /// It's AssemblyQualifiedName of the type.
  32. /// </summary>
  33. [StringLength(NotificationInfo.MaxDataTypeNameLength)]
  34. public virtual string DataTypeName { get; set; }
  35. /// <summary>
  36. /// Gets/sets entity type name, if this is an entity level notification.
  37. /// It's FullName of the entity type.
  38. /// </summary>
  39. [StringLength(NotificationInfo.MaxEntityTypeNameLength)]
  40. public virtual string EntityTypeName { get; set; }
  41. /// <summary>
  42. /// AssemblyQualifiedName of the entity type.
  43. /// </summary>
  44. [StringLength(NotificationInfo.MaxEntityTypeAssemblyQualifiedNameLength)]
  45. public virtual string EntityTypeAssemblyQualifiedName { get; set; }
  46. /// <summary>
  47. /// Gets/sets primary key of the entity, if this is an entity level notification.
  48. /// </summary>
  49. [StringLength(NotificationInfo.MaxEntityIdLength)]
  50. public virtual string EntityId { get; set; }
  51. /// <summary>
  52. /// Notification severity.
  53. /// </summary>
  54. public virtual NotificationSeverity Severity { get; set; }
  55. public TenantNotificationInfo()
  56. {
  57. }
  58. public TenantNotificationInfo(Guid id, int? tenantId, NotificationInfo notification)
  59. {
  60. Id = id;
  61. TenantId = tenantId;
  62. NotificationName = notification.NotificationName;
  63. Data = notification.Data;
  64. DataTypeName = notification.DataTypeName;
  65. EntityTypeName = notification.EntityTypeName;
  66. EntityTypeAssemblyQualifiedName = notification.EntityTypeAssemblyQualifiedName;
  67. EntityId = notification.EntityId;
  68. Severity = notification.Severity;
  69. }
  70. }
  71. }