Skip to content

Instantly share code, notes, and snippets.

@marcduiker
Last active September 4, 2019 11:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marcduiker/0a841a123b103acbcd5fe96437b87084 to your computer and use it in GitHub Desktop.
Save marcduiker/0a841a123b103acbcd5fe96437b87084 to your computer and use it in GitHub Desktop.
Example of using string constants in a static class in order to use these in the [FunctionName] attribute (activity function) and in the CallActivityAsync() method (orchestration function).
namespace DurableFunctions.Demo.DotNetCore.Basics
{
public static class FunctionName
{
public const string HelloNameActivity = "HelloNameActivity";
public const string HelloNameOrchestration = "HelloNameOrchestration";
}
}
namespace DurableFunctions.Demo.DotNetCore.Basics.Activities
{
public static class HelloNameActivity
{
[FunctionName(FunctionName.HelloNameActivity)]
public static string Run(
[ActivityTrigger] string name,
ILogger logger)
{
logger.LogInformation($"Name: {name}");
return $"Hello {name}!";
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment