-
Notifications
You must be signed in to change notification settings - Fork 345
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/bug/476_multiple_methods_per_int…
…erface_with_json_serialisation_doesntwork' into bug/476_multiple_methods_per_interface_with_json_serialisation_doesntwork Signed-off-by: paule96 <[email protected]>
- Loading branch information
Showing
65 changed files
with
2,714 additions
and
172 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,52 @@ | ||
<Project> | ||
<PropertyGroup> | ||
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally> | ||
<CentralPackageTransitivePinningEnabled>true</CentralPackageTransitivePinningEnabled> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<PackageVersion Include="BenchmarkDotNet" Version="0.14.0" /> | ||
<PackageVersion Include="coverlet.collector" Version="6.0.2" /> | ||
<PackageVersion Include="coverlet.msbuild" Version="6.0.2" /> | ||
<PackageVersion Include="FluentAssertions" Version="5.9.0" /> | ||
<PackageVersion Include="GitHubActionsTestLogger" Version="1.1.2" /> | ||
<PackageVersion Include="Google.Api.CommonProtos" Version="2.2.0" /> | ||
<PackageVersion Include="Google.Protobuf" Version="3.28.2" /> | ||
<PackageVersion Include="Grpc.AspNetCore" Version="2.66.0" /> | ||
<PackageVersion Include="Grpc.Core.Testing" Version="2.46.6" /> | ||
<PackageVersion Include="Grpc.Net.Client" Version="2.66.0" /> | ||
<PackageVersion Include="Grpc.Net.ClientFactory" Version="2.66.0" /> | ||
<PackageVersion Include="Grpc.Tools" Version="2.67.0" /> | ||
<PackageVersion Include="Microsoft.AspNetCore.Mvc.Testing" Version="6.0.35" /> | ||
<PackageVersion Include="Microsoft.AspNetCore.TestHost" Version="6.0.35" /> | ||
<PackageVersion Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.4" /> | ||
<PackageVersion Include="Microsoft.CodeAnalysis.Common" Version="4.8.0" /> | ||
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.8.0" /> | ||
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.SourceGenerators.Testing" Version="1.1.2" /> | ||
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.SourceGenerators.Testing.XUnit" Version="1.1.2" /> | ||
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.8.0" /> | ||
<PackageVersion Include="Microsoft.DurableTask.Client.Grpc" Version="1.3.0" /> | ||
<PackageVersion Include="Microsoft.DurableTask.Worker.Grpc" Version="1.3.0" /> | ||
<PackageVersion Include="Microsoft.Extensions.Configuration" Version="6.0.1" /> | ||
<PackageVersion Include="Microsoft.Extensions.Configuration.Abstractions" Version="6.0.0" /> | ||
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="6.0.1" /> | ||
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="6.0.0" /> | ||
<PackageVersion Include="Microsoft.Extensions.Http" Version="6.0.0" /> | ||
<PackageVersion Include="Microsoft.Extensions.Logging" Version="6.0.0" /> | ||
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="6.0.0" /> | ||
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="16.8.3" /> | ||
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="1.1.1" /> | ||
<PackageVersion Include="MinVer" Version="2.3.0" /> | ||
<PackageVersion Include="Moq" Version="4.20.72" /> | ||
<PackageVersion Include="Newtonsoft.Json" Version="13.0.3" /> | ||
<PackageVersion Include="protobuf-net.Grpc.AspNetCore" Version="1.2.2" /> | ||
<PackageVersion Include="Serilog.AspNetCore" Version="6.1.0" /> | ||
<PackageVersion Include="Serilog.Sinks.Console" Version="4.1.0" /> | ||
<PackageVersion Include="Serilog.Sinks.File" Version="5.0.0" /> | ||
<PackageVersion Include="System.Formats.Asn1" Version="6.0.1" /> | ||
<PackageVersion Include="System.Text.Json" Version="8.0.5" /> | ||
<PackageVersion Include="xunit" Version="2.9.2" /> | ||
<PackageVersion Include="xunit.extensibility.core" Version="2.9.2" /> | ||
<PackageVersion Include="xunit.runner.visualstudio" Version="2.8.2" /> | ||
</ItemGroup> | ||
<PropertyGroup> | ||
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally> | ||
<CentralPackageTransitivePinningEnabled>true</CentralPackageTransitivePinningEnabled> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<PackageVersion Include="BenchmarkDotNet" Version="0.14.0" /> | ||
<PackageVersion Include="coverlet.collector" Version="6.0.2" /> | ||
<PackageVersion Include="coverlet.msbuild" Version="6.0.2" /> | ||
<PackageVersion Include="FluentAssertions" Version="5.9.0" /> | ||
<PackageVersion Include="GitHubActionsTestLogger" Version="1.1.2" /> | ||
<PackageVersion Include="Google.Api.CommonProtos" Version="2.2.0" /> | ||
<PackageVersion Include="Google.Protobuf" Version="3.28.2" /> | ||
<PackageVersion Include="Grpc.AspNetCore" Version="2.66.0" /> | ||
<PackageVersion Include="Grpc.Core.Testing" Version="2.46.6" /> | ||
<PackageVersion Include="Grpc.Net.Client" Version="2.66.0" /> | ||
<PackageVersion Include="Grpc.Net.ClientFactory" Version="2.66.0" /> | ||
<PackageVersion Include="Grpc.Tools" Version="2.67.0" /> | ||
<PackageVersion Include="Microsoft.AspNetCore.Mvc.Testing" Version="6.0.35" /> | ||
<PackageVersion Include="Microsoft.AspNetCore.TestHost" Version="6.0.35" /> | ||
<PackageVersion Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.4" /> | ||
<PackageVersion Include="Microsoft.CodeAnalysis.Common" Version="4.8.0" /> | ||
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.8.0" /> | ||
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.SourceGenerators.Testing" Version="1.1.2" /> | ||
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.SourceGenerators.Testing.XUnit" Version="1.1.2" /> | ||
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.8.0" /> | ||
<PackageVersion Include="Microsoft.DurableTask.Client.Grpc" Version="1.3.0" /> | ||
<PackageVersion Include="Microsoft.DurableTask.Worker.Grpc" Version="1.3.0" /> | ||
<PackageVersion Include="Microsoft.Extensions.Configuration" Version="6.0.1" /> | ||
<PackageVersion Include="Microsoft.Extensions.Configuration.Abstractions" Version="6.0.0" /> | ||
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="8.0.1" /> | ||
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.2" /> | ||
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="6.0.1" /> | ||
<PackageVersion Include="Microsoft.Extensions.Http" Version="6.0.0" /> | ||
<PackageVersion Include="Microsoft.Extensions.Logging" Version="6.0.0" /> | ||
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="6.0.4" /> | ||
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="16.8.3" /> | ||
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="1.1.1" /> | ||
<PackageVersion Include="MinVer" Version="2.3.0" /> | ||
<PackageVersion Include="Moq" Version="4.20.72" /> | ||
<PackageVersion Include="Newtonsoft.Json" Version="13.0.3" /> | ||
<PackageVersion Include="protobuf-net.Grpc.AspNetCore" Version="1.2.2" /> | ||
<PackageVersion Include="Serilog.AspNetCore" Version="6.1.0" /> | ||
<PackageVersion Include="Serilog.Sinks.Console" Version="4.1.0" /> | ||
<PackageVersion Include="Serilog.Sinks.File" Version="5.0.0" /> | ||
<PackageVersion Include="System.Formats.Asn1" Version="6.0.1" /> | ||
<PackageVersion Include="System.Text.Json" Version="6.0.10" /> | ||
<PackageVersion Include="xunit" Version="2.9.2" /> | ||
<PackageVersion Include="xunit.extensibility.core" Version="2.9.2" /> | ||
<PackageVersion Include="xunit.runner.visualstudio" Version="2.8.2" /> | ||
</ItemGroup> | ||
</Project> |
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
77 changes: 77 additions & 0 deletions
77
daprdocs/content/en/dotnet-sdk-docs/dotnet-workflow/dotnet-workflowclient-usage.md
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
--- | ||
type: docs | ||
title: "DaprWorkflowClient usage" | ||
linkTitle: "DaprWorkflowClient usage" | ||
weight: 100000 | ||
description: Essential tips and advice for using DaprWorkflowClient | ||
--- | ||
|
||
## Lifetime management | ||
|
||
A `DaprWorkflowClient` holds access to networking resources in the form of TCP sockets used to communicate with the Dapr sidecar as well | ||
as other types used in the management and operation of Workflows. `DaprWorkflowClient` implements `IAsyncDisposable` to support eager | ||
cleanup of resources. | ||
|
||
## Dependency Injection | ||
|
||
The `AddDaprWorkflow()` method will register the Dapr workflow services with ASP.NET Core dependency injection. This method | ||
requires an options delegate that defines each of the workflows and activities you wish to register and use in your application. | ||
|
||
{{% alert title="Note" color="primary" %}} | ||
|
||
This method will attempt to register a `DaprClient` instance, but this will only work if it hasn't already been registered with another | ||
lifetime. For example, an earlier call to `AddDaprClient()` with a singleton lifetime will always use a singleton regardless of the | ||
lifetime chose for the workflow client. The `DaprClient` instance will be used to communicate with the Dapr sidecar and if it's not | ||
yet registered, the lifetime provided during the `AddDaprWorkflow()` registration will be used to register the `DaprWorkflowClient` | ||
as well as its own dependencies. | ||
|
||
{{% /alert %}} | ||
|
||
### Singleton Registration | ||
By default, the `AddDaprWorkflow` method will register the `DaprWorkflowClient` and associated services using a singleton lifetime. This means | ||
that the services will be instantiated only a single time. | ||
|
||
The following is an example of how registration of the `DaprWorkflowClient` as it would appear in a typical `Program.cs` file: | ||
|
||
```csharp | ||
builder.Services.AddDaprWorkflow(options => { | ||
options.RegisterWorkflow<YourWorkflow>(); | ||
options.RegisterActivity<YourActivity>(); | ||
}); | ||
|
||
var app = builder.Build(); | ||
await app.RunAsync(); | ||
``` | ||
|
||
### Scoped Registration | ||
|
||
While this may generally be acceptable in your use case, you may instead wish to override the lifetime specified. This is done by passing a `ServiceLifetime` | ||
argument in `AddDaprWorkflow`. For example, you may wish to inject another scoped service into your ASP.NET Core processing pipeline | ||
that needs context used by the `DaprClient` that wouldn't be available if the former service were registered as a singleton. | ||
|
||
This is demonstrated in the following example: | ||
|
||
```csharp | ||
builder.Services.AddDaprWorkflow(options => { | ||
options.RegisterWorkflow<YourWorkflow>(); | ||
options.RegisterActivity<YourActivity>(); | ||
}, ServiceLifecycle.Scoped); | ||
|
||
var app = builder.Build(); | ||
await app.RunAsync(); | ||
``` | ||
|
||
### Transient Registration | ||
|
||
Finally, Dapr services can also be registered using a transient lifetime meaning that they will be initialized every time they're injected. This | ||
is demonstrated in the following example: | ||
|
||
```csharp | ||
builder.Services.AddDaprWorkflow(options => { | ||
options.RegisterWorkflow<YourWorkflow>(); | ||
options.RegisterActivity<YourActivity>(); | ||
}, ServiceLifecycle.Transient); | ||
|
||
var app = builder.Build(); | ||
await app.RunAsync(); | ||
``` |
Oops, something went wrong.