The `DigitalData.EmailProfiler.Application.csproj` file was updated to downgrade `AutoMapper` and `AutoMapper.Extensions.Microsoft.DependencyInjection` from versions `16.2.0` and `12.0.0` to `12.0.1`. Additionally, a new dependency on `FluentValidation.DependencyInjectionExtensions` version `12.1.1` was added.
The `DigitalData.EmailProfiler.Infrastructure.csproj` file was updated to downgrade the `AutoMapper` package from version `16.2.0` to `12.0.1`.
These changes address potential compatibility issues and introduce FluentValidation for dependency injection.
Controllers:
- EmailProfilesController: CRUD operations (GET sync, POST/PUT/DELETE async via RabbitMQ)
* GET /api/emailprofiles - List all profiles
* GET /api/emailprofiles/{id} - Get profile by ID
* GET /api/emailprofiles/active - List active profiles
* POST /api/emailprofiles - Create (202 Accepted, queued to RabbitMQ)
* PUT /api/emailprofiles/{id} - Update (202 Accepted, queued to RabbitMQ)
* DELETE /api/emailprofiles/{id} - Delete (202 Accepted, queued to RabbitMQ)
- EmailAccountsController: CRUD operations
* GET /api/emailaccounts - List all accounts
* GET /api/emailaccounts/{id} - Get account by ID
* POST /api/emailaccounts - Create (202 Accepted, queued to RabbitMQ)
- EmailHistoryController: Read-only operations
* GET /api/emailhistory/profile/{profileId} - Get history with pagination
* GET /api/emailhistory/{id} - Get history by ID
Changes:
- Fix ICommandPublisher constraint: IRequest → IBaseRequest (supports IRequest<T>)
- All POST/PUT/DELETE return HTTP 202 Accepted (async processing)
- All GET operations return HTTP 200 OK (synchronous via MediatR)
- Proper error handling: 404 Not Found for missing resources
- Move EmailAccountDto.cs to Dtos/ (was in EmailAccounts/ subfolder)
- Move EmailProfileDto.cs to Dtos/ (was in EmailProfiles/ subfolder)
- Keep EmailAttachments/ (3 DTOs) and EmailHistories/ (3 DTOs) subfolders
- Update all namespace imports from Dtos.EmailAccounts/EmailProfiles to Dtos
- Simpler structure: single DTOs at root, multiple DTOs in subfolders
- Consolidated commands and handlers into single files for better organization.
- Updated file naming conventions for commands and queries.
- Added explicit Git operation rules to prevent automatic commits/pushes.
- Introduced new projects and restructured solution file (`legacy` folder).
- Refactored `CreateEmailAccountCommand`, `ProcessEmailCommand`, and others to use `IUnitOfWork`.
- Enhanced `ProcessEmailCommandHandler` with attachment validation and error handling.
- Removed redundant handler files after consolidation.
- Improved code consistency and added `TODO` comments for future enhancements.
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.
A new "Solution Items" folder has been added to the solution, represented by the GUID `{8EC462FD-D22E-90A8-E5CE-7E832BA40C5D}`.
This folder includes the following files:
- `agents.md`
- `IMPLEMENTATION_GUIDE.md`
- `README.md`
- `STATUS.md`
These files are now part of the solution structure, providing better organization and accessibility for project-related documentation.
Comprehensive analysis of the VB.NET legacy system:
- Complete database schema documentation
- All table structures (TBDD_*, TBEMLP_* tables)
- Legacy business logic analysis
- VB.NET code patterns and conventions
- Migration considerations
This documentation ensures new implementation maintains compatibility
with existing database and business rules.
DTOs:
- EmailProfileDto: Profile data transfer object
- EmailAccountDto: Email account data transfer object
- EmailHistoryDto: Email history data transfer object
- EmailAttachmentDto: Attachment data transfer object
Dependencies:
- MediatR 14.2.0 for CQRS (Commands/Queries)
- AutoMapper 12.0.1 for entity-DTO mapping
- FluentValidation 12.1.1 for input validation
This provides the foundation for the application layer implementation.
- 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.
Added project references to establish dependencies between
the API, Application, Domain, and Infrastructure projects.
Updated `DigitalData.EmailProfiler.Tests.csproj` to include
references to all layers for testing purposes. Fixed a BOM
encoding issue in the test project file. Added xUnit usage
directive to ensure proper test framework integration.
Updated the .gitignore file to ignore the following files and directories:
- `FodyWeavers.xsd`
- `/EnvelopeGenerator.Tests.Application/annotations.json`
- `/EnvelopeGenerator.Server/EnvelopeGenerator.Server/TekH - SoftHSM Test.md`
- `/EnvelopeGenerator.Server/EnvelopeGenerator.Server/tekh_softHSM_test.md`
- `/EnvelopeGenerator.Server/EnvelopeGenerator.Server/publish-output`
- `/EnvelopeGenerator.Server/EnvelopeGenerator.Server/tekh_softHSM_test.md+/legacy/App`
These changes ensure that unnecessary or sensitive files are excluded from version control.
A new test project, `DigitalData.EmailProfiler.Tests`, has been added to the solution. The project is configured as a .NET 8.0 test project with xUnit as the testing framework. It includes necessary NuGet dependencies such as `coverlet.collector`, `Microsoft.NET.Test.Sdk`, and `xunit.runner.visualstudio`.
The solution file has been updated to include the new project, along with its build configurations (`Debug|Any CPU` and `Release|Any CPU`). A new solution folder, `tests`, has been added, and the test project is nested under it.
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.
Added a `Worker` class as a hosted background service to log
periodic messages. Updated `DigitalData.EmailProfiler.API.csproj`
to include `UserSecretsId` for secure development storage and
added `Microsoft.Extensions.Hosting` package. Replaced the
`Controllers` folder reference with `Properties`. Updated
`Program.cs` to register the `Worker` service, enable API
exploration, and retain Swagger configuration.
Improved repository configuration by updating `.gitattributes` to:
- Normalize line endings automatically.
- Define diff behavior for C# files and common document formats.
- Add optional merge driver settings for Visual Studio project files.
- Treat image files as binary.
Enhanced `.gitignore` to:
- Exclude Visual Studio-specific files, build outputs, and temporary files.
- Ignore files generated by add-ons, testing frameworks, and tools.
- Add project-specific exclusions for `EnvelopeGenerator`.
These changes enhance maintainability, reduce clutter, and prevent unnecessary files from being committed.