mirror of https://github.com/dapr/dotnet-sdk.git
Merge branch 'master' into actor-srcgen-generic-constraints
This commit is contained in:
commit
4a4a338b7d
|
|
@ -68,12 +68,18 @@ dotnet new web MyApp
|
|||
```
|
||||
|
||||
Next we'll configure the AppHost project to add the necessary package to support local Dapr development. Navigate
|
||||
into the AppHost directory with the following and install the `Aspire.Hosting.Dapr` package from NuGet into the project.
|
||||
into the AppHost directory with the following and install the `CommunityToolkit.Aspire.Hosting.Dapr` package from NuGet into the project.
|
||||
We'll also add a reference to our `MyApp` project so we can reference it during the registration process.
|
||||
|
||||
{{% alert color="primary" %}}
|
||||
|
||||
This package was previously called `Aspire.Hosting.Dapr`, which has been [marked as deprecated](https://www.nuget.org/packages/Aspire.Hosting.Dapr).
|
||||
|
||||
{{% /alert %}}
|
||||
|
||||
```sh
|
||||
cd aspiredemo.AppHost
|
||||
dotnet add package Aspire.Hosting.Dapr
|
||||
dotnet add package CommunityToolkit.Aspire.Hosting.Dapr
|
||||
dotnet add reference ../MyApp/
|
||||
```
|
||||
|
||||
|
|
|
|||
|
|
@ -13,12 +13,11 @@
|
|||
|
||||
namespace Dapr.Workflow
|
||||
{
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using System.Collections.Concurrent;
|
||||
|
||||
/// <summary>
|
||||
/// Defines runtime options for workflows.
|
||||
|
|
@ -26,8 +25,8 @@ namespace Dapr.Workflow
|
|||
internal sealed class WorkflowLoggingService : IHostedService
|
||||
{
|
||||
private readonly ILogger<WorkflowLoggingService> logger;
|
||||
private static readonly HashSet<string> registeredWorkflows = new();
|
||||
private static readonly HashSet<string> registeredActivities = new();
|
||||
private static readonly ConcurrentDictionary<string, byte> registeredWorkflows = new();
|
||||
private static readonly ConcurrentDictionary<string, byte> registeredActivities = new();
|
||||
|
||||
public WorkflowLoggingService(ILogger<WorkflowLoggingService> logger)
|
||||
{
|
||||
|
|
@ -38,13 +37,13 @@ namespace Dapr.Workflow
|
|||
this.logger.Log(LogLevel.Information, "WorkflowLoggingService started");
|
||||
|
||||
this.logger.Log(LogLevel.Information, "List of registered workflows");
|
||||
foreach (string item in registeredWorkflows)
|
||||
foreach (string item in registeredWorkflows.Keys)
|
||||
{
|
||||
this.logger.Log(LogLevel.Information, item);
|
||||
}
|
||||
|
||||
this.logger.Log(LogLevel.Information, "List of registered activities:");
|
||||
foreach (string item in registeredActivities)
|
||||
foreach (string item in registeredActivities.Keys)
|
||||
{
|
||||
this.logger.Log(LogLevel.Information, item);
|
||||
}
|
||||
|
|
@ -55,18 +54,18 @@ namespace Dapr.Workflow
|
|||
public Task StopAsync(CancellationToken cancellationToken)
|
||||
{
|
||||
this.logger.Log(LogLevel.Information, "WorkflowLoggingService stopped");
|
||||
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public static void LogWorkflowName(string workflowName)
|
||||
{
|
||||
registeredWorkflows.Add(workflowName);
|
||||
registeredWorkflows.TryAdd(workflowName, 0);
|
||||
}
|
||||
|
||||
public static void LogActivityName(string activityName)
|
||||
{
|
||||
registeredActivities.Add(activityName);
|
||||
registeredActivities.TryAdd(activityName, 0);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue