From 95bfe0d22bbe2494ef3ba6ca5b6d3219ab9c3ef4 Mon Sep 17 00:00:00 2001 From: Mike Minutillo Date: Thu, 21 Sep 2023 09:33:32 +0800 Subject: [PATCH] Merge pull request #723 from Particular/put-back-functionExecutionContext-class Putting back FunctionExecutionContext --- .../FunctionExecutionContext.cs | 30 +++++++++++++++++++ .../APIApprovals.Approve.approved.txt | 6 ++++ 2 files changed, 36 insertions(+) create mode 100644 src/NServiceBus.AzureFunctions.InProcess.ServiceBus/FunctionExecutionContext.cs diff --git a/src/NServiceBus.AzureFunctions.InProcess.ServiceBus/FunctionExecutionContext.cs b/src/NServiceBus.AzureFunctions.InProcess.ServiceBus/FunctionExecutionContext.cs new file mode 100644 index 00000000..d74dea26 --- /dev/null +++ b/src/NServiceBus.AzureFunctions.InProcess.ServiceBus/FunctionExecutionContext.cs @@ -0,0 +1,30 @@ +namespace NServiceBus +{ + using Microsoft.Azure.WebJobs; + using Microsoft.Extensions.Logging; + + /// + /// Contains specific context information of the current function invocation. + /// + public class FunctionExecutionContext + { + /// + /// Creates a new . + /// + public FunctionExecutionContext(ExecutionContext executionContext, ILogger logger) + { + Logger = logger; + ExecutionContext = executionContext; + } + + /// + /// The associated with the current function invocation. + /// + public ExecutionContext ExecutionContext { get; } + + /// + /// The associated with the current function invocation. + /// + public ILogger Logger { get; } + } +} diff --git a/src/ServiceBus.Tests/ApprovalFiles/APIApprovals.Approve.approved.txt b/src/ServiceBus.Tests/ApprovalFiles/APIApprovals.Approve.approved.txt index 2f698e1b..9b24fcd9 100644 --- a/src/ServiceBus.Tests/ApprovalFiles/APIApprovals.Approve.approved.txt +++ b/src/ServiceBus.Tests/ApprovalFiles/APIApprovals.Approve.approved.txt @@ -2,6 +2,12 @@ [assembly: System.Runtime.CompilerServices.InternalsVisibleTo(@"ServiceBus.Tests, PublicKey=00240000048000009400000006020000002400005253413100040000010001007f16e21368ff041183fab592d9e8ed37e7be355e93323147a1d29983d6e591b04282e4da0c9e18bd901e112c0033925eb7d7872c2f1706655891c5c9d57297994f707d16ee9a8f40d978f064ee1ffc73c0db3f4712691b23bf596f75130f4ec978cf78757ec034625a5f27e6bb50c618931ea49f6f628fd74271c32959efb1c5")] namespace NServiceBus { + public class FunctionExecutionContext + { + public FunctionExecutionContext(Microsoft.Azure.WebJobs.ExecutionContext executionContext, Microsoft.Extensions.Logging.ILogger logger) { } + public Microsoft.Azure.WebJobs.ExecutionContext ExecutionContext { get; } + public Microsoft.Extensions.Logging.ILogger Logger { get; } + } public static class FunctionsHostBuilderExtensions { public static void UseNServiceBus(this Microsoft.Azure.Functions.Extensions.DependencyInjection.IFunctionsHostBuilder functionsHostBuilder, System.Action configurationFactory = null) { }