v1
This commit is contained in:
21
OrpaonVision.Core/Abstractions/IClock.cs
Normal file
21
OrpaonVision.Core/Abstractions/IClock.cs
Normal 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; }
|
||||
}
|
||||
26
OrpaonVision.Core/Abstractions/IUserContext.cs
Normal file
26
OrpaonVision.Core/Abstractions/IUserContext.cs
Normal 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; }
|
||||
}
|
||||
Reference in New Issue
Block a user