-
Notifications
You must be signed in to change notification settings - Fork 358
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding support for scoped service injection
- Loading branch information
Showing
27 changed files
with
476 additions
and
187 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
src/Microsoft.Azure.WebJobs.Host/Executors/FunctionInstanceExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the MIT License. See License.txt in the project root for license information. | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
|
||
namespace Microsoft.Azure.WebJobs.Host.Executors | ||
{ | ||
public static class FunctionInstanceExtensions | ||
{ | ||
public static IServiceProvider GetInstanceServices(this IFunctionInstance instance) | ||
{ | ||
if (instance is IFunctionInstanceEx functionInstance) | ||
{ | ||
return functionInstance.InstanceServices; | ||
} | ||
|
||
return null; | ||
} | ||
|
||
internal static IFunctionInvokerEx GetFunctionInvoker(this IFunctionInstance instance) | ||
{ | ||
if (instance.Invoker == null) | ||
{ | ||
return null; | ||
} | ||
|
||
if (instance.Invoker is IFunctionInvokerEx invoker) | ||
{ | ||
return invoker; | ||
} | ||
|
||
|
||
return new FunctionInvokerWrapper(instance.Invoker); | ||
} | ||
} | ||
} |
Oops, something went wrong.