Application Services
Common service abstractions for application layer.
ICurrentUserService
Access to current authenticated user context.
| Member | Type | Description |
|---|---|---|
| UserId | Guid? | Current user ID |
| string? | Current user email | |
| IsAuthenticated | bool | Is user authenticated |
| User | ClaimsPrincipal? | Full claims principal |
| IsInRole(string) | bool | Check role membership |
| HasPermission(string) | bool | Check permission |
| GetRoles() | IEnumerable<string> | All user roles |
| GetPermissions() | IEnumerable<string> | All user permissions |
| GetClientIpAddress() | string? | Client IP |
| GetUserAgent() | string? | User agent string |
IDateTimeService
Testable date/time abstraction.
| Member | Type | Description |
|---|---|---|
| UtcNow | DateTime | Current UTC time |
| Now | DateTime | Current local time |
| Today | DateOnly | Current UTC date |
Implementation
csharp
public sealed class SystemDateTimeService : IDateTimeService
{
public DateTime UtcNow => DateTime.UtcNow;
public DateTime Now => DateTime.Now;
public DateOnly Today => DateOnly.FromDateTime(DateTime.UtcNow);
}