CRITICAL FIX: Replace all DateTime.UtcNow with DateTime.Now throughout the application.
Reason: Legacy VB.NET system uses local server time, and database stores all
timestamps as local time. Using UTC breaks compatibility and causes incorrect
time comparisons.
Changes:
- EmailProcessedEvent: ProcessedDate now uses DateTime.Now
- EmailHistory.MarkAsProcessed(): ProcessedDate now uses DateTime.Now
- EmailHistory.MarkAsFailed(): ProcessedDate now uses DateTime.Now
- EmailProfile.UpdateLastPollTime(): LastPollTime now uses DateTime.Now
- EmailProfile.ShouldPoll(): Poll interval comparison now uses DateTime.Now
Documentation:
- Added critical note to agents.md about DateTime usage
- Includes examples and detailed explanation for future developers
This ensures all date/time operations remain compatible with legacy database.
- MessageId: Unique message identifier with SHA256 hash
Uses same algorithm as legacy system for duplicate detection compatibility
Hash format: SHA256({originalMessageId}|{sender}|{date}|{subject})
- EmailAddress: Email address validation and parsing with name support
Value objects ensure immutability and value-based equality.
- ErrorCode: All error codes from legacy system (10001-10010)
- ProcessType: Email process types (ProcessManager, AttachmentSniffer, ZugFeRDParser)
- AuthenticationType: Authentication methods (UsernamePassword, OAuth2)
- EmailStatus: Email processing status tracking
- AttachmentStatus: Attachment validation status
These enums maintain compatibility with the legacy VB.NET system.
- Add BaseEntity with audit fields (CreatedDate, CreatedBy, ModifiedDate, ModifiedBy)
- Add IAggregateRoot marker interface for DDD aggregate roots
- Add ValueObject base class with equality comparison by value
These classes provide the foundation for all domain entities and value objects.
Updated Visual Studio version in the solution file to 17.14.36717.8.
Added three new projects: Infrastructure, Domain, and Application,
all targeting .NET 8.0. Enabled implicit global usings and nullable
reference types in the new projects. Updated solution configuration
and nested the new projects under the `src` folder.