Skip to content

Commit 3139001

Browse files
authored
Merge pull request #141 from MarkDerman/TraderBilling-upgrade-Angus
Tweaks for TraderBilling upgrade
2 parents 82bb726 + 61aaf40 commit 3139001

24 files changed

Lines changed: 547 additions & 76 deletions

BackgroundProcessing/Core/Odin.BackgroundProcessing.csproj

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,40 @@
1010
has static entry points to its functionality.
1111

1212

13-
1413
</Description>
1514
<WarningsAsErrors>1591;1573;</WarningsAsErrors> <!-- Not to be removed. Documentation is required. -->
1615
</PropertyGroup>
1716

1817
<ItemGroup>
19-
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="10.0.1" />
20-
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="10.0.1" />
21-
<PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.3.0" />
22-
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="10.0.1" />
18+
<PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.3.0"/>
2319
</ItemGroup>
2420
<ItemGroup>
25-
<ProjectReference Include="..\..\DesignContracts\Core\Odin.DesignContracts.csproj" />
26-
<ProjectReference Include="..\..\System\Activator2\Odin.System.Activator2.csproj" />
27-
<ProjectReference Include="..\..\System\Result\Odin.System.Result.csproj" />
28-
<ProjectReference Include="..\Abstractions\Odin.BackgroundProcessing.Abstractions.csproj" />
21+
<ProjectReference Include="..\..\DesignContracts\Core\Odin.DesignContracts.csproj"/>
22+
<ProjectReference Include="..\..\System\Activator2\Odin.System.Activator2.csproj"/>
23+
<ProjectReference Include="..\..\System\Result\Odin.System.Result.csproj"/>
24+
<ProjectReference Include="..\Abstractions\Odin.BackgroundProcessing.Abstractions.csproj"/>
2925
</ItemGroup>
26+
27+
<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
28+
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="8.0.0"/>
29+
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="8.0.2"/>
30+
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="8.0.1"/>
31+
</ItemGroup>
32+
33+
<ItemGroup Condition="'$(TargetFramework)' == 'net9.0'">
34+
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="9.0.11"/>
35+
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="9.0.11"/>
36+
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="9.0.11"/>
37+
</ItemGroup>
38+
39+
<ItemGroup Condition="'$(TargetFramework)' == 'net10.0'">
40+
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="10.0.1"/>
41+
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="10.0.1"/>
42+
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="10.0.1"/>
43+
</ItemGroup>
44+
45+
3046
<ItemGroup>
31-
<None Include="..\..\Assets\icon.png" Pack="true" PackagePath="" />
47+
<None Include="..\..\Assets\icon.png" Pack="true" PackagePath=""/>
3248
</ItemGroup>
3349
</Project>

Configuration/AzureBlobJson/Odin.Configuration.AzureBlobJson.csproj

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,21 @@
1313

1414
<ItemGroup>
1515
<PackageReference Include="Azure.Storage.Blobs" Version="12.26.0" />
16-
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="10.0.1" />
1716
</ItemGroup>
17+
18+
<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
19+
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.1" />
20+
</ItemGroup>
21+
22+
<ItemGroup Condition="'$(TargetFramework)' == 'net9.0'">
23+
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="9.0.11" />
24+
</ItemGroup>
25+
26+
<ItemGroup Condition="'$(TargetFramework)' == 'net10.0'">
27+
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="10.0.1" />
28+
</ItemGroup>
29+
30+
1831
<ItemGroup>
1932
<None Include="../../Assets/icon.png" Pack="true" PackagePath="" />
2033
</ItemGroup>

Data/SqlScriptsRunner/Odin.Data.SqlScriptsRunner.csproj

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,23 @@
1515
</PropertyGroup>
1616
<ItemGroup>
1717
<PackageReference Include="dbup" Version="5.0.41" />
18+
</ItemGroup>
19+
20+
<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
21+
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="8.0.0" />
22+
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="8.0.2" />
23+
</ItemGroup>
24+
25+
<ItemGroup Condition="'$(TargetFramework)' == 'net9.0'">
26+
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="9.0.11" />
27+
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="9.0.11" />
28+
</ItemGroup>
29+
30+
<ItemGroup Condition="'$(TargetFramework)' == 'net10.0'">
1831
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="10.0.1" />
1932
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="10.0.1" />
2033
</ItemGroup>
34+
2135
<ItemGroup>
2236
<ProjectReference Include="..\..\DesignContracts\Core\Odin.DesignContracts.csproj" />
2337
<ProjectReference Include="..\..\System\Result\Odin.System.Result.csproj" />

Email/Core/IEmailSender.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public interface IEmailSender
1212
/// </summary>
1313
/// <param name="email"></param>
1414
/// <returns>Success and the Mailgun messageId populated in the Value of the Outcome if available.</returns>
15-
Task<ResultValue<string?>> SendEmail(IEmailMessage email);
15+
Task<ResultValue<string>> SendEmail(IEmailMessage email);
1616

1717
}
1818
}

Email/Core/NullEmailSender.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ public sealed class NullEmailSender : IEmailSender
1212
/// </summary>
1313
/// <param name="email"></param>
1414
/// <returns></returns>
15-
public async Task<ResultValue<string?>> SendEmail(IEmailMessage email)
15+
public async Task<ResultValue<string>> SendEmail(IEmailMessage email)
1616
{
17-
return await Task.FromResult(ResultValue<string?>.Success("12345"));
17+
return await Task.FromResult(ResultValue<string>.Success("12345"));
1818
}
1919
}
2020
}

Email/Core/Odin.Email.csproj

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,25 @@
1414
</Description>
1515
<WarningsAsErrors>1591;1573;</WarningsAsErrors> <!-- Not to be removed. Documentation is required. -->
1616
</PropertyGroup>
17-
<ItemGroup>
17+
18+
<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
19+
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="8.0.0" />
20+
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="8.0.2" />
21+
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.2" />
22+
</ItemGroup>
23+
24+
<ItemGroup Condition="'$(TargetFramework)' == 'net9.0'">
25+
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="9.0.11" />
26+
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="9.0.11" />
27+
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="9.0.11" />
28+
</ItemGroup>
29+
30+
<ItemGroup Condition="'$(TargetFramework)' == 'net10.0'">
1831
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="10.0.1" />
1932
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="10.0.1" />
2033
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="10.0.1" />
2134
</ItemGroup>
35+
2236
<ItemGroup>
2337
<ProjectReference Include="..\..\DesignContracts\Core\Odin.DesignContracts.csproj" />
2438
<ProjectReference Include="..\..\System\Activator2\Odin.System.Activator2.csproj" />

Email/Mailgun/MailgunEmailSender.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ private static ByteArrayContent ToByteArrayContent(Stream stream)
110110
/// <param name="email"></param>
111111
/// <returns>An Outcome containing the Mailgun messageId.</returns>
112112
/// <exception cref="HttpRequestException"></exception>
113-
public async Task<ResultValue<string?>> SendEmail(IEmailMessage email)
113+
public async Task<ResultValue<string>> SendEmail(IEmailMessage email)
114114
{
115115
Precondition.RequiresNotNull(email);
116116
Precondition.Requires(email.To.Any(), "Mailgun requires one or more to addresses.");
@@ -182,11 +182,11 @@ private static ByteArrayContent ToByteArrayContent(Stream stream)
182182

183183
MailgunSendResponse? response = await responseMessage.Content.ReadFromJsonAsync<MailgunSendResponse>();
184184
LogSendEmailResult(email, true, LogLevel.Information, $"Sent with Mailgun reference {response?.Id}.");
185-
return ResultValue<string?>.Success(response?.Id);
185+
return ResultValue<string>.Success(response?.Id ?? "");
186186
}
187187
catch (Exception e)
188188
{
189-
return ResultValue<string?>.Failure(e.ToString());
189+
return ResultValue<string>.Failure(e.ToString());
190190
}
191191

192192
}

Email/Office365/Office365EmailSender.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public Office365EmailSender(Office365Options office365Options, EmailSendingOptio
5656
const string MicrosoftGraphFileAttachmentOdataType = "#microsoft.graph.fileAttachment";
5757

5858
/// <inheritdoc />
59-
public async Task<ResultValue<string?>> SendEmail(IEmailMessage email)
59+
public async Task<ResultValue<string>> SendEmail(IEmailMessage email)
6060
{
6161
if (email.From is null)
6262
{
@@ -122,12 +122,12 @@ public Office365EmailSender(Office365Options office365Options, EmailSendingOptio
122122

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

Email/Tests/Mailgun/MailgunEmailSenderTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ public async Task Send_with_attachment()
115115
VerifySuccessfulSendAndLogging(scenario, message, result);
116116
}
117117

118-
private void VerifySuccessfulSendAndLogging(MailgunEmailSenderTestBuilder scenario,EmailMessage message, ResultValue<string?> result)
118+
private void VerifySuccessfulSendAndLogging(MailgunEmailSenderTestBuilder scenario,EmailMessage message, ResultValue<string> result)
119119
{
120120
// Result
121121
Assert.That(result.IsSuccess, Is.True, result.MessagesToString());

Logging/Core/Odin.Logging.csproj

Lines changed: 35 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,38 @@
11
<Project Sdk="Microsoft.NET.Sdk">
2-
<PropertyGroup>
3-
<TargetFrameworks>net8.0;net9.0;net10.0</TargetFrameworks>
4-
<RootNamespace>Odin</RootNamespace>
5-
<ImplicitUsings>true</ImplicitUsings>
6-
<Nullable>enable</Nullable>
7-
<PackageIcon>icon.png</PackageIcon>
8-
<PackageReadmeFile>README.md</PackageReadmeFile>
9-
<Description>Provides ILoggerWrapper that extends .NET's ILogger of T
10-
with all the LogXXX(...) calls as provided by the .NET LoggerExtensions extension methods.
11-
The primary reason being for much more convenient assertions of logger calls compared to mocking ILogger,
12-
and asserting ILogger -&gt; Log(LogLevel logLevel, EventId eventId, TState state, Exception? exception, etc...
13-
14-
15-
2+
<PropertyGroup>
3+
<TargetFrameworks>net8.0;net9.0;net10.0</TargetFrameworks>
4+
<RootNamespace>Odin</RootNamespace>
5+
<ImplicitUsings>true</ImplicitUsings>
6+
<Nullable>enable</Nullable>
7+
<PackageIcon>icon.png</PackageIcon>
8+
<PackageReadmeFile>README.md</PackageReadmeFile>
9+
<Description>Provides ILoggerWrapper that extends .NET's ILogger of T
10+
with all the LogXXX(...) calls as provided by the .NET LoggerExtensions extension methods.
11+
The primary reason being for much more convenient assertions of logger calls compared to mocking ILogger,
12+
and asserting ILogger -&gt; Log(LogLevel logLevel, EventId eventId, TState state, Exception? exception, etc...
13+
14+
1615
</Description>
17-
<WarningsAsErrors>1591;1573;</WarningsAsErrors> <!-- Not to be removed. Documentation is required. -->
18-
</PropertyGroup>
19-
<ItemGroup>
20-
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="10.0.1" />
21-
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="10.0.1" />
22-
</ItemGroup>
23-
<ItemGroup>
24-
<None Include="../../Assets/icon.png" Pack="true" PackagePath="" />
25-
<None Include="..\README.md" Pack="true" PackagePath="" />
26-
</ItemGroup>
16+
<WarningsAsErrors>1591;1573;</WarningsAsErrors> <!-- Not to be removed. Documentation is required. -->
17+
</PropertyGroup>
18+
19+
<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
20+
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.2"/>
21+
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.3"/>
22+
</ItemGroup>
23+
24+
<ItemGroup Condition="'$(TargetFramework)' == 'net9.0'">
25+
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="9.0.11"/>
26+
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="9.0.11"/>
27+
</ItemGroup>
28+
29+
<ItemGroup Condition="'$(TargetFramework)' == 'net10.0'">
30+
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="10.0.1"/>
31+
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="10.0.1"/>
32+
</ItemGroup>
33+
34+
<ItemGroup>
35+
<None Include="../../Assets/icon.png" Pack="true" PackagePath=""/>
36+
<None Include="..\README.md" Pack="true" PackagePath=""/>
37+
</ItemGroup>
2738
</Project>

0 commit comments

Comments
 (0)