Add multi-targeting support for .NET frameworks
Introduced conditional compilation using `#if NET` directives to enable support for multiple frameworks (`net462`, `net480`, and `net8.0`). Updated the project file to support multi-targeting and added framework-specific dependencies conditionally. Refactored namespaces, interfaces, classes, validators, and handlers to ensure compatibility with targeted frameworks. Enhanced dependency injection setup and adjusted logic in `GetSenderQueryHandler` for framework-specific behavior. Ensured consistency and maintainability by wrapping framework- specific code blocks with `#if NET` directives.
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
#if NET
|
||||
using DigitalData.MessagingService.Application.Common.Interfaces;
|
||||
using DigitalData.MessagingService.Application.EmailAccount.Queries;
|
||||
using DigitalData.MessagingService.Domain.Exceptions;
|
||||
@@ -40,3 +41,4 @@ public class MarkEmailAsSeenCommandHandler(
|
||||
await ImapService.MarkAsSeenAsync(account, request.Uid, request.Folder, cancellationToken);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -1,3 +1,4 @@
|
||||
#if NET
|
||||
using DigitalData.MessagingService.Abstraction;
|
||||
using DigitalData.MessagingService.Application.Common.Interfaces;
|
||||
using DigitalData.MessagingService.Application.Common.Models.MailSearch;
|
||||
@@ -43,3 +44,4 @@ public class FetchEmailsQueryHandler(
|
||||
cancellationToken);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -1,4 +1,5 @@
|
||||
using DigitalData.MessagingService.Application.Common.Models.MailSearch;
|
||||
#if NET
|
||||
using DigitalData.MessagingService.Application.Common.Models.MailSearch;
|
||||
using FluentValidation;
|
||||
|
||||
namespace DigitalData.MessagingService.Application.EmailReceiving.Validators;
|
||||
@@ -34,4 +35,5 @@ public class DateFilterValidator : AbstractValidator<DateFilter>
|
||||
.WithMessage("Date.After must be earlier than Date.Before.")
|
||||
.When(x => x.After is not null && x.Before is not null);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -1,3 +1,4 @@
|
||||
#if NET
|
||||
using DigitalData.MessagingService.Application.EmailReceiving.Queries;
|
||||
using FluentValidation;
|
||||
|
||||
@@ -19,4 +20,5 @@ public class FetchEmailsQueryValidator : AbstractValidator<FetchEmailsQuery>
|
||||
.WithMessage("Mail search filter must not be null.")
|
||||
.SetValidator(new MailSearchFilterValidator());
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -1,3 +1,4 @@
|
||||
#if NET
|
||||
using DigitalData.MessagingService.Application.Common.Models.MailSearch;
|
||||
using FluentValidation;
|
||||
|
||||
@@ -48,4 +49,5 @@ public class MailSearchFilterValidator : AbstractValidator<MailSearchFilter>
|
||||
.SetValidator(new DateFilterValidator()!)
|
||||
.When(x => x.Date is not null);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -1,4 +1,5 @@
|
||||
using DigitalData.MessagingService.Application.Common.Models.MailSearch;
|
||||
#if NET
|
||||
using DigitalData.MessagingService.Application.Common.Models.MailSearch;
|
||||
using FluentValidation;
|
||||
|
||||
namespace DigitalData.MessagingService.Application.EmailReceiving.Validators;
|
||||
@@ -45,4 +46,5 @@ public class UidFilterValidator : AbstractValidator<UidFilter>
|
||||
.WithMessage("Uid.Min must be less than or equal to Uid.Max.")
|
||||
.When(x => x.Min is not null && x.Max is not null);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user