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:
2026-08-12 14:40:47 +02:00
parent 5e0de6d52a
commit 4dd0974c6f
18 changed files with 54 additions and 20 deletions

View File

@@ -1,3 +1,4 @@
#if NET
using DigitalData.MessagingService.Abstraction;
using DigitalData.MessagingService.Application.Common.Models.MailSearch;
@@ -31,3 +32,4 @@ public interface IImapEmailService
string folder = "INBOX",
CancellationToken cancellationToken = default);
}
#endif

View File

@@ -1,3 +1,4 @@
#if NET
using AutoMapper;
using DigitalData.MessagingService.Application.EmailSending.Commands;
using DigitalData.MessagingService.Abstraction;
@@ -18,3 +19,4 @@ public class EmailMappingProfile : Profile
.ForMember(dest => dest.Attachments, opt => opt.MapFrom(src => src.Attachments));
}
}
#endif

View File

@@ -1,3 +1,4 @@
#if NET
namespace DigitalData.MessagingService.Application.Common.Models.MailSearch;
/// <summary>
@@ -11,3 +12,4 @@ namespace DigitalData.MessagingService.Application.Common.Models.MailSearch;
/// <param name="After">Earliest date to include (inclusive). Maps to IMAP <c>SINCE</c>.</param>
/// <param name="Before">Latest date to include (inclusive). Maps to IMAP <c>BEFORE</c> (next day is used internally).</param>
public record DateFilter(DateTime? After = null, DateTime? Before = null);
#endif

View File

@@ -1,4 +1,5 @@
namespace DigitalData.MessagingService.Application.Common.Models.MailSearch;
#if NET
namespace DigitalData.MessagingService.Application.Common.Models.MailSearch;
/// <summary>
/// Describes all criteria and options used when searching an IMAP mailbox.
@@ -75,4 +76,5 @@ public record MailSearchFilter
/// See <see cref="DateFilter"/> for rules between its fields.
/// </summary>
public DateFilter? Date { get; init; } = null;
}
}
#endif

View File

@@ -1,4 +1,5 @@
namespace DigitalData.MessagingService.Application.Common.Models.MailSearch;
#if NET
namespace DigitalData.MessagingService.Application.Common.Models.MailSearch;
/// <summary>
/// Constrains the search to a specific UID or a UID range.
@@ -11,4 +12,5 @@
/// <param name="Min">Lower bound of the UID range (inclusive). Ignored when <see cref="Absolute"/> is set.</param>
/// <param name="Max">Upper bound of the UID range (inclusive). Ignored when <see cref="Absolute"/> is set.</param>
/// <param name="Absolute">Exact UID to match. When set, <see cref="Min"/> and <see cref="Max"/> must be <see langword="null"/>.</param>
public record UidFilter(long? Min = null, long? Max = null, long? Absolute = null);
public record UidFilter(long? Min = null, long? Max = null, long? Absolute = null);
#endif

View File

@@ -1,4 +1,5 @@
using DigitalData.MessagingService.Abstraction;
#if NET
using DigitalData.MessagingService.Abstraction;
namespace DigitalData.MessagingService.Application.Common.Options;
@@ -21,3 +22,4 @@ public class EmailAccountsOptions
/// </summary>
public int SyncIntervalSeconds { get; init; } = 300;
}
#endif