This commit is contained in:
2026-03-29 23:17:20 +08:00
commit 7dc5e73af7
36 changed files with 1480 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
namespace OrpaonVision.Core.Abstractions;
/// <summary>
/// 时间服务抽象。
///
/// 用途:
/// - 消除业务代码对 DateTime.Now 的直接依赖;
/// - 提升可测试性,便于通过替身时间源复现时序问题。
/// </summary>
public interface IClock
{
/// <summary>
/// 获取当前本地时间。
/// </summary>
DateTime Now { get; }
/// <summary>
/// 获取当前 UTC 时间。
/// </summary>
DateTime UtcNow { get; }
}

View File

@@ -0,0 +1,26 @@
namespace OrpaonVision.Core.Abstractions;
/// <summary>
/// 当前用户上下文抽象。
///
/// 用途:
/// - 为审计字段CreatedBy/UpdatedBy提供统一来源
/// - 在应用服务中统一获取当前登录人信息。
/// </summary>
public interface IUserContext
{
/// <summary>
/// 当前用户 ID。
/// </summary>
string UserId { get; }
/// <summary>
/// 当前用户名或工号。
/// </summary>
string UserName { get; }
/// <summary>
/// 当前用户角色集合。
/// </summary>
IReadOnlyCollection<string> Roles { get; }
}