Skip to content

Commit ef3a626

Browse files
committed
some changes to expand the usage of custom IFunctionProviders
1 parent b1c0892 commit ef3a626

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

src/WebJobs.Script/Extensions/FunctionMetadataExtensions.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
using System;
55
using System.Collections.Generic;
66
using System.Linq;
7-
using System.Text;
87
using Microsoft.Azure.WebJobs.Script.Description;
98

109
namespace Microsoft.Azure.WebJobs.Script
@@ -62,6 +61,9 @@ public static bool IsDisabled(this FunctionMetadata metadata) =>
6261
public static bool IsCodeless(this FunctionMetadata metadata) =>
6362
GetBoolProperty(metadata.Properties, IsCodelessKey);
6463

64+
public static bool IsCodelessSet(this FunctionMetadata metadata) =>
65+
metadata.Properties.ContainsKey(IsCodelessKey);
66+
6567
/// <summary>
6668
/// Sets a property indicating whether that this function is a direct invoke.
6769
/// </summary>

src/WebJobs.Script/Host/FunctionMetadataManager.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,8 +214,11 @@ private void AddMetadataFromCustomProviders(IEnumerable<IFunctionProvider> funct
214214
throw new InvalidOperationException($"Found duplicate {nameof(FunctionMetadata)} with the name {metadata.Name}");
215215
}
216216

217-
// All custom provided functions are considered codeless functions
218-
metadata.SetIsCodeless(true);
217+
// If not explicitly set, consider the function codeless.
218+
if (!metadata.IsCodelessSet())
219+
{
220+
metadata.SetIsCodeless(true);
221+
}
219222

220223
distinctFunctionNames.Add(metadata.Name);
221224
functionMetadataList.Add(metadata);

src/WebJobs.Script/runtimeassemblies.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -724,15 +724,15 @@
724724
},
725725
{
726726
"name": "System.Collections",
727-
"resolutionPolicy": "minorMatchOrLower"
727+
"resolutionPolicy": "runtimeVersion"
728728
},
729729
{
730730
"name": "System.Collections.Concurrent",
731731
"resolutionPolicy": "minorMatchOrLower"
732732
},
733733
{
734734
"name": "System.Collections.Immutable",
735-
"resolutionPolicy": "minorMatchOrLower"
735+
"resolutionPolicy": "runtimeVersion"
736736
},
737737
{
738738
"name": "System.Collections.NonGeneric",
@@ -1136,7 +1136,7 @@
11361136
},
11371137
{
11381138
"name": "System.Runtime",
1139-
"resolutionPolicy": "minorMatchOrLower"
1139+
"resolutionPolicy": "runtimeVersion"
11401140
},
11411141
{
11421142
"name": "System.Runtime.CompilerServices.VisualC",

0 commit comments

Comments
 (0)