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
public static class DynamicOrchestratorTrigger | |
{ | |
[FunctionName("DynamicOrchestratorTrigger")] | |
public static async Task<IActionResult> RunAsync( | |
[HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)] | |
HttpRequest req, ILogger log, | |
ExecutionContext executionContext, | |
[DurableClient] IDurableOrchestrationClient starter) | |
{ | |
log.LogInformation("C# HTTP trigger function processed a request."); |
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
public class DynamicOrchestrator | |
{ | |
[FunctionName(nameof(DynamicOrchestrator))] | |
public async Task<string> Run([OrchestrationTrigger] IDurableOrchestrationContext context, | |
ExecutionContext executionContext) | |
{ | |
var input = context.GetInput<OrchestratorInput>(); | |
string greeting = ""; |
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
public class DynamicOrchestrator | |
{ | |
[FunctionName(nameof(DynamicOrchestrator))] | |
public async Task<string> Run([OrchestrationTrigger] IDurableOrchestrationContext context, | |
ExecutionContext executionContext) | |
{ | |
var input = context.GetInput<OrchestratorInput>(); | |
return await context.CallSubOrchestratorAsync<string>( | |
await context.CallActivityAsync<string>( |
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
public class DetermineOrchestratorToRunActivity | |
{ | |
[FunctionName(nameof(DetermineOrchestratorToRunActivity))] | |
public async Task<string> Run([ActivityTrigger] IDurableActivityContext context) | |
{ | |
var input= context.GetInput<string>(); | |
string nameOfOrchestrator; | |
switch (input.Length) |
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
[JsonObject(MemberSerialization.OptIn)] | |
public class ShoppingCartEntity : IShoppingCart | |
{ | |
[JsonProperty("list")] | |
private List<CartItem> list { get; set; } = new List<CartItem>(); | |
public void Add(CartItem item) | |
{ | |
// Get existing |
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
AddItemToCart: [POST] http://localhost:7071/api/cart/{id}/add | |
GetCartForSession: [GET] http://localhost:7071/api/cart/{id} | |
RemoveItemFromCart: [POST] http://localhost:7071/api/cart/{id}/remove |
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
[FunctionName("AddItemToCart")] | |
public static async Task<ActionResult> RunAsync( | |
[HttpTrigger(AuthorizationLevel.Function, "post", Route = "cart/{id}/add")] HttpRequestMessage req, | |
Guid id, | |
[DurableClient] IDurableEntityClient client ) | |
{ | |
if (id == Guid.Empty) | |
{ | |
return (ActionResult) new BadRequestObjectResult("Id is required"); | |
} |
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
public class CartItem | |
{ | |
public Guid ProductId { get; set; } | |
public int Count { get; set; } | |
} |
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
[FunctionName("RemoveItemFromCart")] | |
public static async Task<IActionResult> RunAsync( | |
[HttpTrigger(AuthorizationLevel.Anonymous, "post", Route = "cart/{id}/remove")] HttpRequestMessage req, | |
Guid id, | |
[DurableClient] IDurableClient client, ILogger log) | |
{ | |
if (id == Guid.Empty) | |
{ | |
return (ActionResult) new BadRequestObjectResult("Id is required"); |
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
[FunctionName("GetCartForSession")] | |
public static async Task<IActionResult> RunAsync( | |
[HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = "cart/{id}")] HttpRequestMessage req, | |
Guid id, | |
[DurableClient] IDurableClient client, | |
ILogger log) | |
{ | |
if (id == Guid.Empty) | |
{ | |
return (ActionResult) new BadRequestObjectResult("The ID is required"); |
OlderNewer