48 lines
1.3 KiB
C#
48 lines
1.3 KiB
C#
using IRaCIS.Core.Domain.Models;
|
||
using MassTransit;
|
||
using System.ComponentModel;
|
||
using System.Globalization;
|
||
|
||
namespace IRaCIS.Core.Domain.BaseModel;
|
||
|
||
/// <summary>
|
||
/// 事件 不影响数据库提交事务的,不会记录稽查
|
||
///
|
||
/// 比如 添加subject 自动添加访视,不适合作为事件,否则自动添加访视后,记录稽查,当前请求url 都不知道
|
||
/// </summary>
|
||
[Description("领域实体事件基类")]
|
||
public abstract class DomainEvent
|
||
{
|
||
|
||
public Guid EventId { get; set; } = NewId.NextSequentialGuid();
|
||
|
||
//是不是延迟消费的事件,需要用定时任务调度
|
||
public bool IsDelayScheduleEvent => DelaySeconds!=null && DelaySeconds > 0;
|
||
|
||
|
||
/// <summary>
|
||
/// 在事件产生多少s后开始消费该事件
|
||
/// </summary>
|
||
public int? DelaySeconds{ get; set; }
|
||
|
||
public string CultureInfoName { get; set; } = CultureInfo.CurrentCulture.Name;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 命令,触发一些操作,在当前事务一起提交
|
||
/// </summary>
|
||
[Description("领域实体命令基类")]
|
||
public abstract class DomainCommand
|
||
{
|
||
|
||
}
|
||
|
||
public class FailedDomainEvent
|
||
{
|
||
public Guid Id { get; set; }
|
||
public string EventType { get; set; } = string.Empty;
|
||
public string EventData { get; set; } = string.Empty;
|
||
public DateTime FailedAt { get; set; }
|
||
}
|
||
|