Add Publisher.Abstraction project and refactor namespaces

Introduced a new project, `DigitalData.MessagingService.Publisher.Abstraction`, to encapsulate the `OutgoingEmailEvent` class and `IOutgoingEmailPublisher` interface. The project targets multiple frameworks (`net462`, `net480`, `net8.0`) and enables nullable reference types and the latest C# language version.

Moved `OutgoingEmailEvent` and `IOutgoingEmailPublisher` to the new project, updating their namespaces and replacing `required` properties with mutable ones in `OutgoingEmailEvent`. Updated all dependent files to reference the new namespace.

Updated the solution file to include the new project and adjusted build configurations. Cleaned up unused `using` directives and removed redundant `LangVersion` property in the new project file.
This commit is contained in:
2026-07-28 10:18:54 +02:00
parent 0b3ff7cae9
commit 3149bb1cf9
11 changed files with 57 additions and 38 deletions

View File

@@ -0,0 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net462;net480;net8.0</TargetFrameworks>
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>
</PropertyGroup>
</Project>

View File

@@ -1,7 +1,7 @@
using DigitalData.MessagingService.Application.Common.Events;
using DigitalData.MessagingService.Application.EmailSending.Commands;
using System.Threading;
using System.Threading.Tasks;
namespace DigitalData.MessagingService.Application.Common.Interfaces;
namespace DigitalData.MessagingService.Publisher.Abstraction;
/// <summary>
/// Email queue interface for outgoing emails.

View File

@@ -0,0 +1,30 @@
using System;
namespace DigitalData.MessagingService.Publisher.Abstraction;
public class OutgoingEmailEvent
{
public Guid Id { get; set; }
/// <summary>
/// Recipient email address
/// </summary>
public string Recipient { get; set; } = null!;
/// <summary>
/// Email subject
/// </summary>
public string Subject { get; set; } = null!;
/// <summary>
/// Email body (HTML or plain text)
/// </summary>
public string Body { get; set; } = null!;
/// <summary>
/// Is HTML email (default: true)
/// </summary>
public bool IsHtml { get; set; } = true;
public DateTime QueuedAt { get; set; }
}

View File

@@ -37,6 +37,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DigitalData.MessagingServic
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DigitalData.MessagingService.Client.Infrastructure", "DigitalData.MessagingService.Client.Infrastructure\DigitalData.MessagingService.Client.Infrastructure.csproj", "{4ED75E1B-FE53-4AA9-AB83-E35E25049D6D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DigitalData.MessagingService.Publisher.Abstraction", "DigitalData.MessagingService.Publisher\DigitalData.MessagingService.Publisher.Abstraction.csproj", "{99CA4C0E-75A5-4143-97BB-9C605E65E692}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -75,6 +77,10 @@ Global
{4ED75E1B-FE53-4AA9-AB83-E35E25049D6D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4ED75E1B-FE53-4AA9-AB83-E35E25049D6D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4ED75E1B-FE53-4AA9-AB83-E35E25049D6D}.Release|Any CPU.Build.0 = Release|Any CPU
{99CA4C0E-75A5-4143-97BB-9C605E65E692}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{99CA4C0E-75A5-4143-97BB-9C605E65E692}.Debug|Any CPU.Build.0 = Debug|Any CPU
{99CA4C0E-75A5-4143-97BB-9C605E65E692}.Release|Any CPU.ActiveCfg = Release|Any CPU
{99CA4C0E-75A5-4143-97BB-9C605E65E692}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -89,8 +95,9 @@ Global
{DD9D4A3A-AB55-456E-80D3-54A2D4025E64} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
{71BEA4D0-7835-4A8C-B11E-1088E0801DCE} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
{5B941DD2-7D0E-5D58-5D32-7E1B4C249CBC} = {71BEA4D0-7835-4A8C-B11E-1088E0801DCE}
{C553F2ED-1585-E143-70E5-44A8D64D1BDF} = {DD9D4A3A-AB55-456E-80D3-54A2D4025E64}
{C553F2ED-1585-E143-70E5-44A8D64D1BDF} = {B52B4CEE-1C67-424B-8659-370FEA7EAF2A}
{4ED75E1B-FE53-4AA9-AB83-E35E25049D6D} = {71BEA4D0-7835-4A8C-B11E-1088E0801DCE}
{99CA4C0E-75A5-4143-97BB-9C605E65E692} = {DD9D4A3A-AB55-456E-80D3-54A2D4025E64}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {90E29FDC-F6C6-414F-94BF-25DF61D18060}

View File

@@ -1,28 +0,0 @@
namespace DigitalData.MessagingService.Application.Common.Events;
public class OutgoingEmailEvent
{
public required Guid Id { get; init; }
/// <summary>
/// Recipient email address
/// </summary>
public required string Recipient { get; init; }
/// <summary>
/// Email subject
/// </summary>
public required string Subject { get; init; }
/// <summary>
/// Email body (HTML or plain text)
/// </summary>
public required string Body { get; init; }
/// <summary>
/// Is HTML email (default: true)
/// </summary>
public bool IsHtml { get; init; } = true;
public DateTime QueuedAt { get; init; }
}

View File

@@ -1,6 +1,6 @@
using AutoMapper;
using DigitalData.MessagingService.Application.Common.Events;
using DigitalData.MessagingService.Application.EmailSending.Commands;
using DigitalData.MessagingService.Publisher.Abstraction;
namespace DigitalData.MessagingService.Application.Common.Mappings;

View File

@@ -7,6 +7,7 @@
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\DigitalData.MessagingService.Publisher\DigitalData.MessagingService.Publisher.Abstraction.csproj" />
<ProjectReference Include="..\DigitalData.MessagingService.Domain\DigitalData.MessagingService.Domain.csproj" />
</ItemGroup>

View File

@@ -1,6 +1,5 @@
using AutoMapper;
using DigitalData.MessagingService.Application.Common.Events;
using DigitalData.MessagingService.Application.Common.Interfaces;
using DigitalData.MessagingService.Publisher.Abstraction;
using MediatR;
namespace DigitalData.MessagingService.Application.EmailSending.Commands;

View File

@@ -2,6 +2,7 @@ using DigitalData.MessagingService.Application.Common.Interfaces;
using DigitalData.MessagingService.Infrastructure.Queue;
using DigitalData.MessagingService.Infrastructure.Services;
using DigitalData.MessagingService.Infrastructure.Services.Background;
using DigitalData.MessagingService.Publisher.Abstraction;
using DigitalData.MessagingService.RabbitMQ;
using Microsoft.AspNetCore.DataProtection;
using Microsoft.Extensions.Configuration;

View File

@@ -1,12 +1,12 @@
using System.Text;
using System.Text.Json;
using DigitalData.MessagingService.Application.Common.Interfaces;
using DigitalData.MessagingService.Publisher.Abstraction;
using DigitalData.MessagingService.RabbitMQ;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using RabbitMQ.Client;
using RabbitMQ.Client.Events;
using DigitalData.MessagingService.Application.Common.Events;
namespace DigitalData.MessagingService.Infrastructure.Queue;

View File

@@ -1,11 +1,10 @@
using System.Text;
using System.Text.Json;
using DigitalData.MessagingService.Application.Common.Interfaces;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using RabbitMQ.Client;
using DigitalData.MessagingService.Application.Common.Events;
using DigitalData.MessagingService.RabbitMQ;
using DigitalData.MessagingService.Publisher.Abstraction;
namespace DigitalData.MessagingService.Infrastructure.Queue;