Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 26 additions & 10 deletions BackgroundProcessing/Core/Odin.BackgroundProcessing.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,40 @@
has static entry points to its functionality.



</Description>
<WarningsAsErrors>1591;1573;</WarningsAsErrors> <!-- Not to be removed. Documentation is required. -->
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="10.0.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="10.0.1" />
<PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.3.0" />
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="10.0.1" />
<PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.3.0"/>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\DesignContracts\Core\Odin.DesignContracts.csproj" />
<ProjectReference Include="..\..\System\Activator2\Odin.System.Activator2.csproj" />
<ProjectReference Include="..\..\System\Result\Odin.System.Result.csproj" />
<ProjectReference Include="..\Abstractions\Odin.BackgroundProcessing.Abstractions.csproj" />
<ProjectReference Include="..\..\DesignContracts\Core\Odin.DesignContracts.csproj"/>
<ProjectReference Include="..\..\System\Activator2\Odin.System.Activator2.csproj"/>
<ProjectReference Include="..\..\System\Result\Odin.System.Result.csproj"/>
<ProjectReference Include="..\Abstractions\Odin.BackgroundProcessing.Abstractions.csproj"/>
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="8.0.0"/>
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="8.0.2"/>
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="8.0.1"/>
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net9.0'">
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="9.0.11"/>
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="9.0.11"/>
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="9.0.11"/>
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net10.0'">
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="10.0.1"/>
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="10.0.1"/>
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="10.0.1"/>
</ItemGroup>


<ItemGroup>
<None Include="..\..\Assets\icon.png" Pack="true" PackagePath="" />
<None Include="..\..\Assets\icon.png" Pack="true" PackagePath=""/>
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,21 @@

<ItemGroup>
<PackageReference Include="Azure.Storage.Blobs" Version="12.26.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="10.0.1" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.1" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net9.0'">
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="9.0.11" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net10.0'">
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="10.0.1" />
</ItemGroup>


<ItemGroup>
<None Include="../../Assets/icon.png" Pack="true" PackagePath="" />
</ItemGroup>
Expand Down
14 changes: 14 additions & 0 deletions Data/SqlScriptsRunner/Odin.Data.SqlScriptsRunner.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,23 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="dbup" Version="5.0.41" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="8.0.2" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net9.0'">
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="9.0.11" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="9.0.11" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net10.0'">
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="10.0.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="10.0.1" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\DesignContracts\Core\Odin.DesignContracts.csproj" />
<ProjectReference Include="..\..\System\Result\Odin.System.Result.csproj" />
Expand Down
2 changes: 1 addition & 1 deletion Email/Core/IEmailSender.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public interface IEmailSender
/// </summary>
/// <param name="email"></param>
/// <returns>Success and the Mailgun messageId populated in the Value of the Outcome if available.</returns>
Task<ResultValue<string?>> SendEmail(IEmailMessage email);
Task<ResultValue<string>> SendEmail(IEmailMessage email);

}
}
4 changes: 2 additions & 2 deletions Email/Core/NullEmailSender.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ public sealed class NullEmailSender : IEmailSender
/// </summary>
/// <param name="email"></param>
/// <returns></returns>
public async Task<ResultValue<string?>> SendEmail(IEmailMessage email)
public async Task<ResultValue<string>> SendEmail(IEmailMessage email)
{
return await Task.FromResult(ResultValue<string?>.Success("12345"));
return await Task.FromResult(ResultValue<string>.Success("12345"));
}
}
}
16 changes: 15 additions & 1 deletion Email/Core/Odin.Email.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,25 @@
</Description>
<WarningsAsErrors>1591;1573;</WarningsAsErrors> <!-- Not to be removed. Documentation is required. -->
</PropertyGroup>
<ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="8.0.2" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.2" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net9.0'">
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="9.0.11" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="9.0.11" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="9.0.11" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net10.0'">
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="10.0.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="10.0.1" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="10.0.1" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\DesignContracts\Core\Odin.DesignContracts.csproj" />
<ProjectReference Include="..\..\System\Activator2\Odin.System.Activator2.csproj" />
Expand Down
6 changes: 3 additions & 3 deletions Email/Mailgun/MailgunEmailSender.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ private static ByteArrayContent ToByteArrayContent(Stream stream)
/// <param name="email"></param>
/// <returns>An Outcome containing the Mailgun messageId.</returns>
/// <exception cref="HttpRequestException"></exception>
public async Task<ResultValue<string?>> SendEmail(IEmailMessage email)
public async Task<ResultValue<string>> SendEmail(IEmailMessage email)
{
Precondition.RequiresNotNull(email);
Precondition.Requires(email.To.Any(), "Mailgun requires one or more to addresses.");
Expand Down Expand Up @@ -182,11 +182,11 @@ private static ByteArrayContent ToByteArrayContent(Stream stream)

MailgunSendResponse? response = await responseMessage.Content.ReadFromJsonAsync<MailgunSendResponse>();
LogSendEmailResult(email, true, LogLevel.Information, $"Sent with Mailgun reference {response?.Id}.");
return ResultValue<string?>.Success(response?.Id);
return ResultValue<string>.Success(response?.Id ?? "");
}
catch (Exception e)
{
return ResultValue<string?>.Failure(e.ToString());
return ResultValue<string>.Failure(e.ToString());
}

}
Expand Down
6 changes: 3 additions & 3 deletions Email/Office365/Office365EmailSender.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public Office365EmailSender(Office365Options office365Options, EmailSendingOptio
const string MicrosoftGraphFileAttachmentOdataType = "#microsoft.graph.fileAttachment";

/// <inheritdoc />
public async Task<ResultValue<string?>> SendEmail(IEmailMessage email)
public async Task<ResultValue<string>> SendEmail(IEmailMessage email)
{
if (email.From is null)
{
Expand Down Expand Up @@ -122,12 +122,12 @@ public Office365EmailSender(Office365Options office365Options, EmailSendingOptio

await _graphClient.Users[_senderUserId].SendMail.PostAsync(requestBody);
LogSendEmailResult(email, true, LogLevel.Information, $"Sent with Office365 via user {_senderUserId}");
return ResultValue<string?>.Success("Success");
return ResultValue<string>.Success("Success");
}
catch (Exception ex)
{
LogSendEmailResult(email, false, LogLevel.Error, $"Failed to send with Office365 via user {_senderUserId}", ex);
return ResultValue<string?>.Failure("Fail: " + ex.Message);
return ResultValue<string>.Failure("Fail: " + ex.Message);
}
}

Expand Down
2 changes: 1 addition & 1 deletion Email/Tests/Mailgun/MailgunEmailSenderTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public async Task Send_with_attachment()
VerifySuccessfulSendAndLogging(scenario, message, result);
}

private void VerifySuccessfulSendAndLogging(MailgunEmailSenderTestBuilder scenario,EmailMessage message, ResultValue<string?> result)
private void VerifySuccessfulSendAndLogging(MailgunEmailSenderTestBuilder scenario,EmailMessage message, ResultValue<string> result)
{
// Result
Assert.That(result.IsSuccess, Is.True, result.MessagesToString());
Expand Down
59 changes: 35 additions & 24 deletions Logging/Core/Odin.Logging.csproj
Original file line number Diff line number Diff line change
@@ -1,27 +1,38 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net8.0;net9.0;net10.0</TargetFrameworks>
<RootNamespace>Odin</RootNamespace>
<ImplicitUsings>true</ImplicitUsings>
<Nullable>enable</Nullable>
<PackageIcon>icon.png</PackageIcon>
<PackageReadmeFile>README.md</PackageReadmeFile>
<Description>Provides ILoggerWrapper that extends .NET's ILogger of T
with all the LogXXX(...) calls as provided by the .NET LoggerExtensions extension methods.
The primary reason being for much more convenient assertions of logger calls compared to mocking ILogger,
and asserting ILogger -&gt; Log(LogLevel logLevel, EventId eventId, TState state, Exception? exception, etc...



<PropertyGroup>
<TargetFrameworks>net8.0;net9.0;net10.0</TargetFrameworks>
<RootNamespace>Odin</RootNamespace>
<ImplicitUsings>true</ImplicitUsings>
<Nullable>enable</Nullable>
<PackageIcon>icon.png</PackageIcon>
<PackageReadmeFile>README.md</PackageReadmeFile>
<Description>Provides ILoggerWrapper that extends .NET's ILogger of T
with all the LogXXX(...) calls as provided by the .NET LoggerExtensions extension methods.
The primary reason being for much more convenient assertions of logger calls compared to mocking ILogger,
and asserting ILogger -&gt; Log(LogLevel logLevel, EventId eventId, TState state, Exception? exception, etc...


</Description>
<WarningsAsErrors>1591;1573;</WarningsAsErrors> <!-- Not to be removed. Documentation is required. -->
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="10.0.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="10.0.1" />
</ItemGroup>
<ItemGroup>
<None Include="../../Assets/icon.png" Pack="true" PackagePath="" />
<None Include="..\README.md" Pack="true" PackagePath="" />
</ItemGroup>
<WarningsAsErrors>1591;1573;</WarningsAsErrors> <!-- Not to be removed. Documentation is required. -->
</PropertyGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.2"/>
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.3"/>
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net9.0'">
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="9.0.11"/>
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="9.0.11"/>
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net10.0'">
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="10.0.1"/>
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="10.0.1"/>
</ItemGroup>

<ItemGroup>
<None Include="../../Assets/icon.png" Pack="true" PackagePath=""/>
<None Include="..\README.md" Pack="true" PackagePath=""/>
</ItemGroup>
</Project>
16 changes: 15 additions & 1 deletion Messaging/RabbitMq/Odin.Messaging.RabbitMq.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,24 @@
<NoWarn>CS1591</NoWarn>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="RabbitMQ.Client" Version="7.2.0" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="8.0.2" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net9.0'">
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="9.0.11" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="9.0.11" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net10.0'">
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="10.0.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="10.0.1" />
<PackageReference Include="RabbitMQ.Client" Version="7.2.0" />
</ItemGroup>

<ItemGroup>
<None Include="../../Assets/icon.png" Pack="true" PackagePath="" />
</ItemGroup>
Expand Down
14 changes: 13 additions & 1 deletion RemoteFiles/Core/Odin.RemoteFiles.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,22 @@
<ProjectReference Include="..\..\RemoteFiles\Abstractions\Odin.RemoteFiles.Abstractions.csproj" />
<ProjectReference Include="..\..\RemoteFiles\SFTP\Odin.RemoteFiles.SFTP.csproj" />
</ItemGroup>
<ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="8.0.2" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net9.0'">
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="9.0.11" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="9.0.11" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net10.0'">
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="10.0.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="10.0.1" />
</ItemGroup>

<ItemGroup>
<None Include="../../Assets/icon.png" Pack="true" PackagePath="" />
</ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion System/Activator2/Activator2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public static ResultValue<T> TryCreate<T>(string typeName, string assemblyName)
return ResultValue<T>.Failure($"Type {typeName} is not of type {nameof(T)}");
}

private static ResultValue<T> CreateInstanceFailure<T>(string typeName, string assemblyName, string? errorMessage = "")
private static ResultValue<T> CreateInstanceFailure<T>(string typeName, string assemblyName, string? errorMessage = "") where T : notnull
{
return ResultValue<T>.Failure($"Could not create instance of type {typeName} from assembly {assemblyName}. {errorMessage}");
}
Expand Down
2 changes: 1 addition & 1 deletion System/Result/MessageEx.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace Odin.System;
/// <summary>
/// Extended 'Message' including a Severity, and optional Exception.
/// </summary>
public record MessageEx
public class MessageEx
{
/// <summary>
/// Message content. Can be null.
Expand Down
12 changes: 11 additions & 1 deletion System/Result/Odin.System.Result.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,19 @@
</Description>
<WarningsAsErrors>1591;1573;</WarningsAsErrors> <!-- Not to be removed. Documentation is required. -->
</PropertyGroup>
<ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.3" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net9.0'">
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="9.0.11" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net10.0'">
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="10.0.1" />
</ItemGroup>

<ItemGroup>
<None Include="../../Assets/icon.png" Pack="true" PackagePath="" />
<None Include="README.md" Pack="true" PackagePath="" />
Expand Down
2 changes: 1 addition & 1 deletion System/Result/Result.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/// Represents the outcome of an operation that was successful or failed,
/// together with a list of Messages.
/// </summary>
public record Result : Result<string>
public class Result : Result<string>
{
/// <inheritdoc />
public Result()
Expand Down
2 changes: 1 addition & 1 deletion System/Result/ResultEx.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace Odin.System
/// Like Result, but with a list of Messages of type ResultMessage2
/// which includes a Severity, a Message and optionally an Exception.
/// </summary>
public record ResultEx : Result<MessageEx>
public class ResultEx : Result<MessageEx>
{
/// <inheritdoc />
public ResultEx()
Expand Down
Loading
Loading