Skip to content

Commit

Permalink
Upgrade dependencies to latest
Browse files Browse the repository at this point in the history
dotnet new beef targets .NET 8
  • Loading branch information
chullybun committed Jan 16, 2024
1 parent a72fa44 commit 6880b8d
Show file tree
Hide file tree
Showing 27 changed files with 169 additions and 165 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
Represents the **NuGet** versions.

## v5.9.0
- *Fixed:* Upgraded `CoreEx` (`v3.9.0`) to include all related fixes and improvements; including dependent `UnitTestEx`.
- *Enhancement:* Updated the `dotnet new beef` template to default to `net8.0`.
- *Fixed:* Upgraded `CoreEx` ([`v3.9.0`](https://github.com/Avanade/CoreEx/blob/main/CHANGELOG.md#v390)) and `DbEx` ([`v2.4.0`](https://github.com/Avanade/DbEx/blob/main/CHANGELOG.md#v240)) to include all related fixes and improvements; including dependent `UnitTestEx` ([`v4.0.1`](https://github.com/Avanade/UnitTestEx/blob/main/CHANGELOG.md#v410)) and related `NUnit` ([`v4.0.1`](https://docs.nunit.org/articles/nunit/release-notes/Nunit4.0-MigrationGuide.html)) upgrades.
- *Enhancement:* Updated the `dotnet new beef` template to target `net8.0` and updated `NUnit`.

## v5.8.0
- *Fixed:* Upgraded `CoreEx` (`v3.8.0`) to include all related fixes and improvements; `WebApi` class supports returning value of `IActionResult` as-is.
Expand Down
5 changes: 2 additions & 3 deletions samples/MyEf.Hr/MyEf.Hr.Api/MyEf.Hr.Api.csproj
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>true</ImplicitUsings>
<GenerateDocumentationFile>True</GenerateDocumentationFile>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="CoreEx.AspNetCore" Version="3.9.0" />
<PackageReference Include="CoreEx.Azure" Version="3.9.0" />
<PackageReference Include="OpenTelemetry.Instrumentation.EntityFrameworkCore" Version="1.0.0-beta.7" />
<PackageReference Include="OpenTelemetry.Instrumentation.EntityFrameworkCore" Version="1.0.0-beta.9" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
<PackageReference Include="Swashbuckle.AspNetCore.Newtonsoft" Version="6.5.0" />
<PackageReference Include="Azure.Monitor.OpenTelemetry.AspNetCore" Version="1.0.0" />
</ItemGroup>
<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions samples/MyEf.Hr/MyEf.Hr.Business/MyEf.Hr.Business.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>true</ImplicitUsings>
</PropertyGroup>
Expand All @@ -9,7 +9,7 @@
<PackageReference Include="CoreEx.Database.SqlServer" Version="3.9.0" />
<PackageReference Include="CoreEx.EntityFrameworkCore" Version="3.9.0" />
<PackageReference Include="CoreEx.Validation" Version="3.9.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.20" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.1" />
</ItemGroup>
<ItemGroup>
<Folder Include="Data\EfModel\Generated\" />
Expand Down
2 changes: 1 addition & 1 deletion samples/MyEf.Hr/MyEf.Hr.CodeGen/MyEf.Hr.CodeGen.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
Expand Down
7 changes: 1 addition & 6 deletions samples/MyEf.Hr/MyEf.Hr.Database/MyEf.Hr.Database.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
</PropertyGroup>

Expand All @@ -25,9 +25,4 @@
<ProjectReference Include="..\..\..\tools\Beef.Database.SqlServer\Beef.Database.SqlServer.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="7.0.0" />
<PackageReference Include="Microsoft.Tye.Extensions.Configuration" Version="0.10.0-alpha.21420.1" />
</ItemGroup>

</Project>
14 changes: 7 additions & 7 deletions samples/MyEf.Hr/MyEf.Hr.Security.Subscriptions/GlobalUsings.cs
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
global using Azure.Messaging.ServiceBus;
global using CoreEx;
global using CoreEx.Events;
global using CoreEx.Events.Subscribing;
global using CoreEx.Azure.ServiceBus;
global using CoreEx.Configuration;
global using CoreEx.Events;
global using CoreEx.Events.Subscribing;
global using CoreEx.Hosting;
global using CoreEx.Http;
global using CoreEx.Json;
global using CoreEx.RefData;
global using CoreEx.Results;
global using CoreEx.Validation;
global using Microsoft.Azure.Functions.Extensions.DependencyInjection;
global using Microsoft.Azure.WebJobs;
global using Microsoft.Azure.WebJobs.ServiceBus;
global using Microsoft.Azure.Functions.Worker;
global using Microsoft.Extensions.Configuration;
global using Microsoft.Extensions.DependencyInjection;
global using Microsoft.Extensions.Hosting;
global using Microsoft.Extensions.Logging;
global using MyEf.Hr.Common.Entities;
global using System;
global using System.Collections.Generic;
global using System.Linq;
global using System.Text;
global using System.Threading.Tasks;
global using System.Threading.Tasks;
global using MyEf.Hr.Common.Entities;
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<AzureFunctionsVersion>v4</AzureFunctionsVersion>
<ImplicitUsings>true</ImplicitUsings>
<OutputType>Exe</OutputType>
<Nullable>enable</Nullable>
<!-- Following needed as per: https://github.com/Azure/azure-functions-core-tools/issues/2872 -->
<_FunctionsSkipCleanOutput>true</_FunctionsSkipCleanOutput>
</PropertyGroup>
<ItemGroup>
<None Remove="appsettings.json" />
Expand All @@ -18,10 +17,11 @@
<ItemGroup>
<PackageReference Include="CoreEx.Azure" Version="3.9.0" />
<PackageReference Include="CoreEx.Validation" Version="3.9.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker" Version="1.20.1" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.ServiceBus" Version="5.15.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="1.16.4" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.ApplicationInsights" Version="1.1.0" />
<PackageReference Include="Microsoft.ApplicationInsights.WorkerService" Version="2.22.0" />
<PackageReference Include="Microsoft.Azure.Functions.Extensions" Version="1.1.0" />
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.ServiceBus" Version="5.13.5" />
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="4.2.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\MyEf.Hr.Common\MyEf.Hr.Common.csproj" />
Expand Down
9 changes: 9 additions & 0 deletions samples/MyEf.Hr/MyEf.Hr.Security.Subscriptions/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
new HostBuilder()
.ConfigureFunctionsWorkerDefaults()
.ConfigureServices(services =>
{
services.AddApplicationInsightsTelemetryWorkerService();
services.ConfigureFunctionsApplicationInsights();
})
.ConfigureHostStartup<MyEf.Hr.Security.Subscriptions.Startup>()
.Build().Run();
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
namespace MyEf.Hr.Security.Subscriptions;

public class SecuritySubscriberFunction
public class SecuritySubscriberFunction(ServiceBusOrchestratedSubscriber subscriber)
{
private readonly ServiceBusOrchestratedSubscriber _subscriber;
private readonly ServiceBusOrchestratedSubscriber _subscriber = subscriber.ThrowIfNull();

public SecuritySubscriberFunction(ServiceBusOrchestratedSubscriber subscriber) => _subscriber = subscriber ?? throw new ArgumentNullException(nameof(subscriber));

[Singleton(Mode = SingletonMode.Function)]
[FunctionName(nameof(SecuritySubscriberFunction))]
[Function(nameof(SecuritySubscriberFunction))]
public Task RunAsync([ServiceBusTrigger("%ServiceBusQueueName%", Connection = "ServiceBusConnectionString")] ServiceBusReceivedMessage message, ServiceBusMessageActions messageActions, CancellationToken cancellationToken)
=> _subscriber.ReceiveAsync(message, messageActions, null, cancellationToken);
}
22 changes: 13 additions & 9 deletions samples/MyEf.Hr/MyEf.Hr.Security.Subscriptions/Startup.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
[assembly: FunctionsStartup(typeof(MyEf.Hr.Security.Subscriptions.Startup))]
namespace MyEf.Hr.Security.Subscriptions;

namespace MyEf.Hr.Security.Subscriptions;

public class Startup : FunctionsStartup
/// <summary>
/// The <see cref="HostStartup"/> to enable testable dependency injection.
/// </summary>
public class Startup : HostStartup
{
public override void ConfigureAppConfiguration(IFunctionsConfigurationBuilder builder) => builder.ConfigurationBuilder
.AddJsonFile(Path.Combine(builder.GetContext().ApplicationRootPath ?? "", "appsettings.json"), optional: true)
.AddEnvironmentVariables("Hr_");
/// <inheritdoc/>
public override void ConfigureAppConfiguration(HostBuilderContext context, IConfigurationBuilder config)
{
config.AddEnvironmentVariables("MyEf_Hr_");
}

public override void Configure(IFunctionsHostBuilder builder)
/// <inheritdoc/>
public override void ConfigureServices(IServiceCollection services)
{
builder.Services
services
.AddSettings<SecuritySettings>()
.AddExecutionContext()
.AddJsonSerializer()
Expand Down
3 changes: 2 additions & 1 deletion samples/MyEf.Hr/MyEf.Hr.Security.Subscriptions/host.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"samplingSettings": {
"isEnabled": true,
"excludedTypes": "Request"
}
},
"enableLiveMetricsFilters": true
},
"logLevel": {
"default": "Warning",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

<IsPackable>false</IsPackable>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ public class SecuritySubscriberFunctionTest
public void InvalidMessage_DeadLetter()
{
using var test = FunctionTester.Create<Startup>();
var actions = test.CreateWebJobsServiceBusMessageActions();
var actions = test.CreateWorkerServiceBusMessageActions();
var message = test.CreateServiceBusMessageFromValue<string>(null!);

test.ServiceBusTrigger<SecuritySubscriberFunction>()
Expand All @@ -21,7 +21,7 @@ public void InvalidMessage_DeadLetter()
public void NotSubscribed_CompleteSilent()
{
using var test = FunctionTester.Create<Startup>();
var actions = test.CreateWebJobsServiceBusMessageActions();
var actions = test.CreateWorkerServiceBusMessageActions();
var message = test.CreateServiceBusMessage(new EventData { Subject = "myef.hr.employee", Action = "updated", Source = new Uri("test", UriKind.Relative) });

test.ServiceBusTrigger<SecuritySubscriberFunction>()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public void ValueIsRequired_DeadLetter()
{
using var test = FunctionTester.Create<Startup>();
var message = test.CreateServiceBusMessage(new EventData<Employee> { Subject = "myef.hr.employee", Action = "terminated", Source = new Uri("test", UriKind.Relative), Value = null! });
var actions = test.CreateServiceBusMessageActions();
var actions = test.CreateWorkerServiceBusMessageActions();

test.ServiceBusTrigger<SecuritySubscriberFunction>()
.Run(f => f.RunAsync(message, actions, default))
Expand All @@ -22,7 +22,7 @@ public void ValidationError_DeadLetter()
{
using var test = FunctionTester.Create<Startup>();
var message = test.CreateServiceBusMessage(new EventData<Employee> { Subject = "myef.hr.employee", Action = "terminated", Source = new Uri("test", UriKind.Relative), Value = new Employee() });
var actions = test.CreateServiceBusMessageActions();
var actions = test.CreateWorkerServiceBusMessageActions();

test.ServiceBusTrigger<SecuritySubscriberFunction>()
.ExpectLogContains("A data validation error occurred")
Expand All @@ -40,7 +40,7 @@ public void EmailNotFound_None_Complete()
mc.Request(HttpMethod.Get, "/api/v1/users?search=profile.email eq \"[email protected]\"").Respond.WithJson("[]", HttpStatusCode.OK);

using var test = FunctionTester.Create<Startup>();
var actions = test.CreateServiceBusMessageActions();
var actions = test.CreateWorkerServiceBusMessageActions();
var message = test.CreateServiceBusMessage(
new EventData<Employee> { Subject = "myef.hr.employee", Action = "terminated", Source = new Uri("test", UriKind.Relative), Value = new Employee { Id = 1.ToGuid(), Email = "[email protected]", Termination = new() } });

Expand All @@ -62,7 +62,7 @@ public void EmailNotFound_Multi_Complete()
mc.Request(HttpMethod.Get, "/api/v1/users?search=profile.email eq \"[email protected]\"").Respond.WithJson("[{},{}]", HttpStatusCode.OK);

using var test = FunctionTester.Create<Startup>();
var actions = test.CreateServiceBusMessageActions();
var actions = test.CreateWorkerServiceBusMessageActions();
var message = test.CreateServiceBusMessage(
new EventData<Employee> { Subject = "myef.hr.employee", Action = "terminated", Source = new Uri("test", UriKind.Relative), Value = new Employee { Id = 1.ToGuid(), Email = "[email protected]", Termination = new() } });

Expand All @@ -84,7 +84,7 @@ public void OktaForbidden_Retry()
mc.Request(HttpMethod.Get, "/api/v1/users?search=profile.email eq \"[email protected]\"").Respond.With(HttpStatusCode.Forbidden);

using var test = FunctionTester.Create<Startup>();
var actions = test.CreateWebJobsServiceBusMessageActions();
var actions = test.CreateWorkerServiceBusMessageActions();
var message = test.CreateServiceBusMessage(
new EventData<Employee> { Subject = "myef.hr.employee", Action = "terminated", Source = new Uri("test", UriKind.Relative), Value = new Employee { Id = 1.ToGuid(), Email = "[email protected]", Termination = new() } });

Expand All @@ -111,7 +111,7 @@ public void OktaServiceUnavailable_Retry()
});

using var test = FunctionTester.Create<Startup>();
var actions = test.CreateWebJobsServiceBusMessageActions();
var actions = test.CreateWorkerServiceBusMessageActions();
var message = test.CreateServiceBusMessage(
new EventData<Employee> { Subject = "myef.hr.employee", Action = "terminated", Source = new Uri("test", UriKind.Relative), Value = new Employee { Id = 1.ToGuid(), Email = "[email protected]", Termination = new() } });

Expand All @@ -134,7 +134,7 @@ public void SuccessDeactivated_Complete()
mc.Request(HttpMethod.Post, "/api/v1/users/00ub0oNGTSWTBKOLGLNR/lifecycle/deactivate?sendEmail=true").Respond.With(HttpStatusCode.OK);

using var test = FunctionTester.Create<Startup>();
var actions = test.CreateWebJobsServiceBusMessageActions();
var actions = test.CreateWorkerServiceBusMessageActions();
var message = test.CreateServiceBusMessage(
new EventData<Employee> { Subject = "myef.hr.employee", Action = "terminated", Source = new Uri("test", UriKind.Relative), Value = new Employee { Id = 1.ToGuid(), Email = "[email protected]", Termination = new() } });

Expand All @@ -155,7 +155,7 @@ public void SuccessAlreadyDeactivated_Complete()
mc.Request(HttpMethod.Get, "/api/v1/users?search=profile.email eq \"[email protected]\"").Respond.WithJson(new [] { new { id = "00ub0oNGTSWTBKOLGLNR", status = "DEACTIVATED" } });

using var test = FunctionTester.Create<Startup>();
var actions = test.CreateWebJobsServiceBusMessageActions();
var actions = test.CreateWorkerServiceBusMessageActions();
var message = test.CreateServiceBusMessage(
new EventData<Employee> { Subject = "myef.hr.employee", Action = "terminated", Source = new Uri("test", UriKind.Relative), Value = new Employee { Id = 1.ToGuid(), Email = "[email protected]", Termination = new() } });

Expand Down
Loading

0 comments on commit 6880b8d

Please sign in to comment.