Skip to content

Commit 3309dd6

Browse files
Merge pull request #213699 from ggailey777/patch-3
[WebJobs] Clarify custom resolver dependencies
2 parents 19eecb9 + 041b03a commit 3309dd6

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

articles/app-service/webjobs-sdk-how-to.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,7 @@ For more information about binding expressions, see [Binding expressions and pat
589589

590590
Sometimes you want to specify a queue name, a blob name or container, or a table name in code rather than hard-coding it. For example, you might want to specify the queue name for the `QueueTrigger` attribute in a configuration file or environment variable.
591591

592-
You can do that by passing a `NameResolver` object in to the `JobHostConfiguration` object. You include placeholders in trigger or binding attribute constructor parameters, and your `NameResolver` code provides the actual values to be used in place of those placeholders. You identify placeholders by surrounding them with percent (%) signs, as shown here:
592+
You can do that by passing a custom name resolver during configuration. You include placeholders in trigger or binding attribute constructor parameters, and your resolver code provides the actual values to be used in place of those placeholders. You identify placeholders by surrounding them with percent (%) signs, as shown here:
593593

594594
```cs
595595
public static void WriteLog([QueueTrigger("%logqueue%")] string logMessage)
@@ -600,9 +600,15 @@ public static void WriteLog([QueueTrigger("%logqueue%")] string logMessage)
600600

601601
This code lets you use a queue named `logqueuetest` in the test environment and one named `logqueueprod` in production. Instead of a hard-coded queue name, you specify the name of an entry in the `appSettings` collection.
602602

603-
There's a default `NameResolver` that takes effect if you don't provide a custom one. The default gets values from app settings or environment variables.
603+
There's a default resolver that takes effect if you don't provide a custom one. The default gets values from app settings or environment variables.
604604

605-
Your `NameResolver` class gets the queue name from `appSettings`, as shown here:
605+
Starting in .NET Core 3.1, the [`ConfigurationManager`](/dotnet/api/system.configuration.configurationmanager) you use requires the [System.Configuration.ConfigurationManager NuGet package](https://www.nuget.org/packages/System.Configuration.ConfigurationManager). The sample requires the following `using` statement:
606+
607+
```cs
608+
using System.Configuration;
609+
```
610+
611+
Your `NameResolver` class gets the queue name from app settings, as shown here:
606612

607613
```cs
608614
public class CustomNameResolver : INameResolver

0 commit comments

Comments
 (0)