Updated ROADMAP.md to mark Phase 2 as completed and added detailed descriptions of completed tasks. Introduced three new value objects (`Base64String`, `TenantId`, and `PdfMetadata`) in the `DocumentOperator.Domain.Models.ValueObjects` namespace. These classes ensure type safety, immutability, and encapsulated validation. - `Base64String`: Handles Base64 string creation, validation, and conversion. - `TenantId`: Represents a tenant identifier with validation and normalization. - `PdfMetadata`: Represents PDF metadata with computed properties. Updated `DocumentOperator.Domain.csproj` to reflect the addition of these value objects. The project is now ready to begin Phase 3 (Infrastructure Layer).
41 lines
991 B
C#
41 lines
991 B
C#
namespace DocumentOperator.Domain.Models.ValueObjects;
|
|
|
|
public sealed class TenantId
|
|
{
|
|
public string Value { get; }
|
|
|
|
private TenantId(string value)
|
|
{
|
|
Value = value;
|
|
}
|
|
|
|
public static TenantId Create(string value)
|
|
{
|
|
if (string.IsNullOrWhiteSpace(value))
|
|
throw new Common.Exceptions.DomainValidationException("TenantId cannot be empty.");
|
|
|
|
if (value.Length > 100)
|
|
throw new Common.Exceptions.DomainValidationException("TenantId cannot exceed 100 characters.");
|
|
|
|
// Normalisierung: Lowercase
|
|
var normalized = value.Trim().ToLowerInvariant();
|
|
|
|
return new TenantId(normalized);
|
|
}
|
|
|
|
public override string ToString() => Value;
|
|
|
|
// Equality
|
|
public override bool Equals(object? obj)
|
|
{
|
|
if (obj is not TenantId other)
|
|
return false;
|
|
|
|
return Value == other.Value;
|
|
}
|
|
|
|
public override int GetHashCode()
|
|
{
|
|
return Value.GetHashCode();
|
|
}
|
|
} |